ASP.net memory usage during download
On an ASP.net site at my place of work, the following chunk of code is responsible for handling file downloads (NOTE: Response.TransmitFile is not used here because the contents of the download are being streamed from a zip file): private void DownloadFile( Stream stream) { int bytesRead; int chunkSize = 1048576; //1MB byte[] readBuffer = new byte[chunkSize]; while ((bytesRead = stream.Read(readBuffer, 0, readBuffer.Length)) != 0) { if(!Response.IsClientConnected) break; byte[] chunk = new byte[bytesRead]; Array.Copy(readBuffer,0,chunk,0,bytesRead); Response.BinaryWrite(chunk); Response.Flush(