Error Description: Thread was being aborted
If you use
Response.End
,
Response.Redirect
, or
Server.Transfer
method, will appear
ThreadAbortException
exception. You can use the
try-catch
statement to catch this exception.
the reason
Application_EndRequest event Response.End method terminates execution page, and this execution to switch to the application's event pipeline. Line behind Response.End not performed.
This problem occurs in the Response.Redirect and Server.Transfer methods because both methods call Response.End internally.
To resolve this problem, use one of the following methods:
1, for Response.End , call HttpContext.Current.ApplicationInstance.CompleteRequest method instead Response.End to skip Application_EndRequest code for an event execution
2. For Response.Redirect, use a heavy-duty Response.Redirect (String url, bool endResponse) , the reload pass false endResponse parameters for internal calls to cancel the Response.End. For example: Response.Redirect ( "nextpage.aspx", false );
Reproduced in: https: //www.cnblogs.com/TSPWater/archive/2011/01/05/1926358.html