Symptoms (symptom)
If you use the response. End, response. Redirect, or server. transfer method, a threadabortexception exception occurs. You can use a try-catch statement to catch this exception.
Cause)
The response. End method ends the page execution and shifts the execution to the application_endrequest event in the application's event pipeline. The line of code that follows response. end is not executed.
This problem occurs in the response. Redirect and server. transfer methods because both methods call response. End internally.
Resolution (solution)
To work around this problem, use one of the following methods:
• For response. End, call the httpcontext. Current. applicationinstance. completerequest method instead of response. End to bypass the code execution to the application_endrequest event.
• For response. Redirect, use an overload, response. Redirect (string URL, bool endresponse) that passes false for the endresponse parameter to suppress the internal call to response. End. For example:
Response. Redirect ("nextpage. aspx", false );// This method is relatively simple.
If you use this workaround, the code that follows response. Redirect is executed.
•Server. Transfer, UseServer. ExecuteMethod instead.
Self: http://hi.baidu.com/richard_cxs/blog/item/18024859d365ba2b2834f017.html