Sending files to the client

B

Buddy Ackerman

I'm sending file to the client (see sample code below) but when I send a large file the user gets a document contains no
data message.


response.contenttype = "application/x-unknown"
myheader = "attachment;filename=order123.zip"
Response.AddHeader("Content-Disposition", myheader)
Response.WriteFile(FileName, StartPos, FileSize)


I'm dynamically creating the ZIP file (prior to the above code running but in the same page). It only takes about 10
seconds to create the zip file.


The file I'm having trouble with is 112MB. It takes about 15 - 20 second to create the file. The code itself does not
create an error but the end user gets a message (from the browser) that says "the document contains no data", the
messages comes up immediately after the code has completed (this is based on me seeing the last datbase instruction
being sent which is immediately after the file creation is complete and right before the response.writefile instruction.

I also tested the page by bypassing the code that creates the file and just had it try and send the file (since it
already existed from the previous run) but I got the same message. Funny though, the message still took about 30 second
to display.


Also to make sure that the zip file was a valid zip, I opened it in WinZip (with no problems).


Is there some kind of limit when sending files like this? Smller files seem to work fine, although I haven't determined
the threshold for failure. Would it have anything to do with the amount of available RAM?




--Buddy
 

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,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top