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.
Creating Understanding and Educating Programmers, Developers and Technical Communities, one post at a time.
Wednesday, October 7, 2009
Subscribe to:
Post Comments (Atom)
In my case, it's not working
ReplyDeleteIn my case also, it's not working
ReplyDeleteserver.execute is displaying the previous page also
ReplyDeleteya response.redirect(url,bool value ) is working fine
ReplyDelete