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

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top