Why is ASP.NET replacing a Content-Length header with a Transfer-Encoding header when manually flushing a response?

后端 未结 3 1073
滥情空心
滥情空心 2021-02-07 07:40

Our web application (ASP.NET Web Forms) has a page that will display a recently generated PDF file to users. Because the PDF file is sometimes quite large, we\'ve implemented a

3条回答
  •  闹比i
    闹比i (楼主)
    2021-02-07 08:02

    I had a similar problem when I was writing a large CSV (The file didn't exist I write a string line by line by iterating through an in memory collection and generating the line) by calling Response.Write on the Response stream with BufferOutput set to false, but the solution was to change

    Reponse.ContentType = 'text/csv' to Reponse.ContentType = 'application/octet-stream'

    When the content type wasn't set to application/octet-stream a bunch of other response headers were added such as Content-Encoding - gzip

提交回复
热议问题