The "thread was being aborted." exception is thrown in the ASP. NET program.

Source: Internet
Author: User

This problem suddenly occurred today! But there is no error after refreshing the page! This error was not reported before! ... But I still Google the answer!

Thread was being aborted: The thread is terminated.

Reference address:Http://support.microsoft.com/default.aspx/kb/312629/EN-US? P = 1

Cause:

The response. End method ends the execution of the page and transfers it to the executed application_endrequest event in the ApplicationProgramEvent pipeline. For this rowCodeThe following response. end will not be executed.

This problem occurs in the response. Redirect and server. transfer method, because the two methods call response. End internally.

Solution:

To solve this problem, use one of the following methods:

To response. End, call the httpcontext. Current. applicationinstance. completerequest method instead of the application_endrequest event that the response. End code bypasses.
For response. Redirect, the use of overload, the passage of response. Redirect (string URL, bool endresponse) False is the endresponse parameter to suppress the internal call response. End. For example:
Response. Redirect ("nextpage. aspx", false );
If you use this solution, the following code response. Redirect is executed.
For the server. Transfer Method, use the server. Execute method instead.
Also: Try not to write the response. Redirect ("TargetUrl"); statement in try! Use response. Redirect ("TargetUrl", false );

This article from the csdn blog, reproduced please indicate the source: http://blog.csdn.net/jinho/archive/2010/03/11/5367242.aspx

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.