Hi,
I have an asp.net web page to serve large file downloads to users. The page is hosted on IIS7, Windows Server 2008.
The strange thing is that users can download at good speeds (2MB/s) when I don't add a content-length response header but as soon as I add this header, download speed drops to somewhere around 35kbps/s.
This is the code:
Response.Clear();
Response.ClearContent();
Response.ClearHeaders();
Response.ContentType = "application/octet-stream";
//speed drops when I add this line:
//Response.AddHeader("Content-Length", new FileInfo(filepath).ToString());
Response.AddHeader("Content-Disposition", "attachment; filename=" + filename);
Response.TransmitFile(filepath);
Response.Flush();
Of course I can leave the content-length out but the user will not know how big the file is and how long the download will take...which is annoying.
Any idea what can cause this big change in download speed?
Thanks in advance for any insights!