title: Is it necessary to set the Content-Length in my response header?
body: <p>I'm reviewing some legacy code and I've found a bug that causes the response to sit indefinitely.</p>
  
  <p>Here's the basic idea:</p>
  
  <pre><code>Response.Content-Type = "application/octet-stream"
  Response.AddHeader("Content-Disposition", "attachment; filename" &amp; someFileName)
  Response.AddHeader("Content-Length", someStoredLength)
  Response.BinaryWrite(someByteArray)
  Response.Flush()
  Response.End()
  </code></pre>
  
  <p>The problem is that someStoredLength is much larger than the actual size of someByteArray, so the client just sits there waiting for the file download while the browser just spins.</p>
  
  <p>I'm contemplating just removing the AddHeader that specifies the content length, because when I do that everything seems to work fine, but I'm worried that I'm not understanding something.</p>
  
  <p>Is it ok for me to remove this AddHeader or should I figure out a better way to deal with this problem?</p>