title: Response.TransmitFile and delete it after transmission
body: <p>I have to implement GEDCOM export in my site.</p>
  
  <p>My .net code created one file at server when export to gedcom clicked.</p>
  
  <p>Then I need to download it to client from server, as well as user should be asked where to save that file, meaning savedialog is required. </p>
  
  <p>After it's downloaded, I want to delete that file from server.</p>
  
  <p>I got one code to transmit file from server to client:</p>
  
  <pre><code>Response.ContentType = "text/xml";
  Response.AppendHeader("Content-Disposition", "attachment; filename=" + FileName);
  Response.TransmitFile(Server.MapPath("~/" + FileName));
  Response.End();
  </code></pre>
  
  <p>from this <a href="http://www.west-wind.com/weblog/posts/76293.aspx" rel="nofollow noreferrer">LINK</a></p>
  
  <p>but I am not able to delete the file after this code as <code>Response.End</code> ends response so whatever code written after that line is not execute. </p>
  
  <p>If I do code to delete file before <code>Response.End();</code>, then file does not transmitted and I get an error.</p>