Downloading Files

Buffering in IIS/ASP.NET

By default, ASP.NET buffers content on the server side before sending output. To eliminate keeping entire file content in memory before sending, turn off buffering setting BufferOutput property to false:

HttpContext.Current.Response.BufferOutput = false;

Timeout in IIS/ASP.NET

To prevent canceling script execution when downloading a large file from IIS/ASP.NET server extend the script timeout value:

HttpContext.Current.Server.ScriptTimeout = 2400; // timeout in seconds.

Range Header

The WebDAV engine provides the means for downloading only a part of a file. The client application could send Range header to specify a range of bytes to download. Download managers may use this feature to resume downloads or download a single file using several threads at a time.