title: ASP.NET file download from server
body: <p>After a user clicks a button, I want a file to be downloaded. I've tried the following which seems to work, but not without throwing an exception (ThreadAbort) which is not acceptable.</p>
  
  <pre><code>    System.Web.HttpResponse response = System.Web.HttpContext.Current.Response;
      response.ClearContent();
      response.Clear();
      response.ContentType = "text/plain";
      response.AddHeader("Content-Disposition", "attachment; filename=" + fileName + ";");
      response.TransmitFile(Server.MapPath("FileDownload.csv"));
      response.Flush();
      response.End();  
  </code></pre>