title: Correct usage of Asp.Net Response.TransmitFile and Response.End()
body: <p>What is the correct usage of this code?</p>
  
  <pre><code>httpContext.Response.AddHeader("Content-Disposition", "inline; filename=" + HttpUtility.UrlPathEncode(fileName));
  httpContext.Response.ContentType = "image/png";
  httpContext.Response.AddHeader("Content-Length", new FileInfo(physicalFileName).Length.ToString());
  httpContext.Response.TransmitFile(physicalFileName);
  httpContext.Response.Flush();
  httpContext.Response.End();  //Use it or not?
  </code></pre>
  
  <p>Is it really good to use <code>.Flush()</code> and <code>.End()</code>?</p>
  
  <p>According to <a href="http://blogs.msdn.com/b/aspnetue/archive/2010/05/25/response-end-response-close-and-how-customer-feedback-helps-us-improve-msdn-documentation.aspx" rel="nofollow noreferrer">this</a> you should never ever use <code>Response.End()</code> (only in error or hacking scenarios)</p>
  
  <p>But in some of the answers the <code>.End()</code> is reconmended...?</p>
  
  <p>Like in <a href="https://stackoverflow.com/questions/8570269/using-response-transmitfile-to-download-file-but-also-contains-the-page-source">this</a> article.</p>
  
  <p>So it is appropriate to use <code>Response.End</code> or not?</p>