File download in a Web application

  • Thread starter Thread starter ShikariShambu
  • Start date Start date
S

ShikariShambu

Hi All,
We have numerous instance where we allow the user to download files from
our web site.

We don't allow them to open it within browser window. They have to save it
locally.

Of late we have been running into out of memory issues with the ASP.NEt
process becuase of the file download. We put the contents of the file on a
HTTP reponse buffer and that means larger the file more memory ASP.NET
process consumes. And, if multiple users are doing the same thing the
ASP.NET process hits the memory threshold and recycles.

Is there a way to allow for file downloads without having to eat into the
asp.net process memory?

TIA
 
turn off Page buffering. then read and write the file in chunks.

note: with this approach, the file will stay open until the download
finishes, and you can hit max open files limits, though iis limits you to
about 128 active downloads anyway. if downloads are slow, then try:

loop
open file read next chunk
close file
send file chunk
flush response
end loop


-- bruce (sqlwork.com)
 
Back
Top