title: why Response.End Not working?
body: <p>May be it is a Duplicate question. But my case is something different.  I have a page to download the text file. In the page first i decrypt the text file into <code>string plainText</code>. then write that string into a file and upload to a folder named as Decrypted Files. The download that decrypted file and delete previously saved file. </p>
  
  <p>here is my code for download</p>
  
  <pre><code>                //Write the decrypted text to folder in the server.
                  System.IO.File.WriteAllText(Server.MapPath("~/Decrypted Files/" + FileName), plainText);
  
                  //Code for Download
                  Response.Clear();
                  Response.ContentType = "application/octet-stream";
                  Response.AddHeader("Content-Disposition", "attachment; filename='" + FileName + "'");
                  Response.WriteFile(Server.MapPath("~/Decrypted Files/" + FileName));
  
                  //Delete File from the folder
                  if (System.IO.File.Exists(Server.MapPath("~/Decrypted Files/" + FileName)))
                  {
                      System.IO.File.Delete((Server.MapPath("~/Decrypted Files/" + FileName)));
                  }
  
                  Response.End();
  </code></pre>
  
  <p>But The code execution not continue from <code>Response.End();</code> and the .aspx page not finishing its loading. What is wrong with my code ?  </p>