Downloading 200MB+ files and errors in .NET

B

blantz

I am using Forms Authentication to force a login to a support folder,
where there are large .exe and .zip files for download. In my
web.config file, i am blocking these file extensions with a
httpHandler

<httpHandlers>
<add verb="*" path="*.exe" type="MyHandler.NewHandler,httpHandler"/>
<add verb="*" path="*.zip" type="MyHandler.NewHandler,httpHandler"/>
</httpHandlers>

The code that downloads the files in the handler is...

string strFileName =
context.Request.MapPath(context.Request.ServerVariables["PATH_INFO"]);
FileInfo myFile = new FileInfo(strFileName);
objResponse.AddHeader("Content-Disposition","attachment; filename=" +
myFile.Name);
objResponse.ContentType = "application/octet-stream";
objResponse.TransmitFile(myFile.Name);
objResponse.Flush();
objResponse.End();

My problem is that when you are downloading a file, part way through
an error message appears saying, "The connection with the server has
been reset" or the file will seem to have downloaded correct, but only
40 or 50 mb's have been downloaded.

I thought it may be a timeout issue, so i made this change to the
web.config file... nothing changed though.

<system.web>
<httpRuntime executionTimeout="36000" />
</system.web>
 
L

lantz

Thanks for the reply... but we already tried that way. Instead of
Response.WriteFile we are using Response.TransmitFile which just became
available several weeks ago.

Any other thoughts?
 

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,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top