title: download of large files slow when content-length specified (IIS7)
body: <p>I have an asp.net web page to serve large file downloads to users.
  The page is hosted on IIS7, Windows Server 2008.</p>
  
  <p>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.</p>
  
  <p>This is the code:</p>
  
  <pre><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();
  </code></pre>
  
  <p>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. </p>
  
  <p>Any idea what can cause this big change in download speed?</p>
  
  <p>Thanks in advance for any insights!</p>