Writing a file to output using Response.BinaryWrite?

C

Chris Ashley

I have a stream of bytes (making up a large file) coming from
somewhere, and need to send it to the user. I can't send it to
Response.OutputStream because this is read only, and storing the
entire file in memory and then outputting that isn't really an option
as the files are in excess of 200mb each. I am considering having a
loop, and reading the stream and creating a buffer byte array every
100kb or so, and then using Response.BinaryWrite to send this to the
user - will this work if I set buffer to false and set the headers/
contenttype correctly (IE: User gets file download box, and as they
download my loop runs sending the bytes through), or will the user
just see junk?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,733
Messages
2,569,439
Members
44,829
Latest member
PIXThurman

Latest Threads

Top