Files being written to Response.OutputStream hang 25% of the time

C

Chris Ashley

I'm writing files directly to Response.OutputStream... setting the
headers like so:

HttpContext.Current.Response.Buffer = false;
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.ContentType = "binary/octet-
stream";
HttpContext.Current.Response.AddHeader("content-disposition",
"attachment;filename=" + strOutputFilename);
long lngSize = GetFileSize(strFTPURL, strFileName);
HttpContext.Current.Response.AddHeader("Content-Length",
lngSize.ToString());
HttpContext.Current.Response.Flush();

BeginDownloadToStream(HttpContext.Current.Response.OutputStream,
strFileName);

About 25% of the time, when the user downloads the file, the file
download box hangs at 99%.

If the user then clicks cancel and tries to download the same file
again, it works every single time.

Problem is not isolated to any particular file... just happens 25% of
the time with random files, and always works the second time around.

No exceptions are being thrown anywhere, so I'm at a loss as to what
is going wrong...

anybody have any ideas?
 

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top