1. symptom:
When debugging the ASP. NET program, you can view the Visual Studio output window while viewing the browser window. The following information is displayed:
The first "mscorlib. dll" exception that occurs occasionally in system. Threading. threadabortexception
An exception of the "system. Threading. threadabortexception" type occurs in mscorlib. dll, but not in user code.
Internet query: http://www.cnblogs.com/wbcms/archive/2008/03/24/1119307.html
2. cause:
Because your code is called internallyResponse. End ()OrResponse. Redirect ("")AndServer. Transfer ("")The two methods, because the two methods also call response. End () internally ().
The response. End method stops page execution and converts the execution to the application_endrequest event in the event pipeline of the application. The code lines after response. End are not executed.
This phenomenon is caused by design.
3. solution:
(1), response. End ()->Applicationinstance. completerequestTo skip the code execution of the application_endrequest event.Httpcontext. Current. applicationinstance. completerequest ();
(2), response. Redirect ()->Response. Redirect (string URL, bool endresponse = false),
It passes false to the endresponse parameter to cancel the internal call to response. End. If this solution is used,The Code following response. Redirect will be executed..
(3), server. Transfer ()->Server. Execute ()