‘Thread was being aborted’on using Response.Redirect,Response.End
This is a very common error that is encountered.This is because Response.End ends the Page Execution and transfers the execution to Application_EndRequest event and the line following the Response.End is not executed.
This problem occurs for the Response.Redirect method also as when this method is used, an internal call to Response.End is made.
How to resolve it?
Instead of Response.End,use HttpContext.Current.ApplicationInstance.CompleteRequest method.
For Response.Redirect,set the endResponse parameter in the method to false.It indicates that the execution of the current page should not terminate.
Eg:
Response.Redirect("~/Default.aspx",false);
This error also happens when Server.Transfer method is called.Just use Server.Execute method instead.
Related posts:








Leave your response!