I have been using varying solutions for allowing users to view or download files from my ASP.NET web sites. Today I found an article on MSDN that addresses the subject in great detail:
Build Smarter ASP.NET File Downloading Into Your Web Applications by Joe Stagner
In addition, the article addresses the following:
- The Basic Download Link
- Forcing Downloads for All File Types
- Downloading Huge Files in Small Pieces
- Resuming Downloads that Fail
Another item was brought to my attention while reading this article is the TransmitFile function in released in ASP.NET 2.0 check out this blurb from the article:
The commonality of file download requirements, and the
ever-increasing size of the files in general, caused the ASP.NET
development team to add a specific method to ASP.NET for downloading
files without buffering the file in memory before sending it to the
browser. That method is Response.TransmitFile, which is available in
ASP.NET 2.0.
TransmitFile can be used just like WriteFile, but
typically yields better performance characteristics. TransmitFile also
comes compete with additional functionality.
Very good stuff to know. A big "Thank you" goes out to Joe, for sharing his knowledge.