I need to run several methods after sending file to a user for a download. What happens is that after I send a file to a user, response is aborted and I can no longer do any
I recommend this solution :
Don't use response.End();
Declare this global var : bool isFileDownLoad;
Just after your (Response.BinaryWrite(a);) set ==> isFileDownLoad = true;
Override your Render like :
/// /// AEG : Very important to handle the thread aborted exception /// /// override protected void Render(HtmlTextWriter w) { if (!isFileDownLoad) base.Render(w); }