sending a file 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.

Is there some kind of limit when sending files like this?



--Buddy
 
S

Steve C. Orr [MVP, MCSD]

The zip file must be fully created when WriteFile is called.
It sounds like that may not be the case for you.
 
B

Buddy Ackerman

That's not the case. I have database activity that occurs after the file is created and before the response.write and
when I trace the database activity everything is happening in the proper sequence ( I even watch the directory to see
that the file exists before I get the error message from my browser).
 
S

Steve C. Orr [MVP, MCSD]

Exactly how big is the file we're talking about?
What is the error message you're getting?
How long does it take for the error message to appear?
 
B

Buddy Ackerman

The file 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).
 
S

Steve C. Orr [MVP, MCSD]

Do smaller files work?
If so, then we've narrowed it down to be an issue with downloading large
files.
 

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

Staff online

Members online

Forum statistics

Threads
473,769
Messages
2,569,577
Members
45,054
Latest member
LucyCarper

Latest Threads

Top