I was working on project. Everything was fine but exception log showed
"Thread was being aborted". I further looked into and found out
System.Threading.ThreadAbortException:It is because
Response.Redirect and
Server.Transfer methods take me to another page and call
Response.End internally.
Response.End immediately ends the page execution and shifts the execution to the
Application_EndRequest event in the application's event
pipeline. This make impossible to execute current page code.
You can avoid such exception by using overload method of
Response.Redirect(string url, bool endResponse), and pass false value for second argument. It will suppress the interal call to
Response.End.
You can use
Server.Execute instead of
Server.Transfer.