Reading a binary file and using Response.BinaryWrite()

后端 未结 10 1929
既然无缘
既然无缘 2020-11-28 12:16

I have an app that needs to read a PDF file from the file system and then write it out to the user. The PDF is 183KB and seems to work perfectly. When I use the code at th

10条回答
  •  感情败类
    2020-11-28 12:47

    I also found it necessary to add the following:

    Response.Encoding = Encoding.Default
    

    If I didn't include this, my JPEG was corrupt and double the size in bytes.

    But only if the handler was returning from an ASPX page. It seemed running from an ASHX this was not required.

提交回复
热议问题