[Help] 'thread was being aborted' in Asp.net is abnormal.

Source: Internet
Author: User
We all know that in Asp.net, server. Transfer and response. redirec are doing similar things, but there is a big difference.
One difference is that response. Redirect will re-initiate a request, so the process of the current request will be abort. Therefore, a 'thread was being aborted' exception is thrown every time the response. Redirect method is used. I have read the relevant information and think that the best way to solve this problem is not to write Response. Redirect within try/catch, so this exception will not occur.
Now, I need ProgramBy clicking the trigger response. Redirect method to go to a specific page (similar to ABC. aspx? Par1 = 1 & par2 = demopar), but every time the 'thread was being aborted' exception occurs, I capture the exception on the page and go to the error handling page. The strange thing is that this exception occurs at intervals. That is to say, I clicked the first time to go to the error handling page. I clicked the second time, the second time, the third time, the error handling page, and the fourth time, normal processing. According to the tracking data, this exception is thrown every time. So I am wondering why this interval processing occurs.
To solve this problem, I put the Redirect method out of try/catch according to the suggestions on the Internet. The result is indeed no exception, and the server returns a completely blank page to me. It feels like the current request is still dropped by abort, but the page has no output because I have not caught this exception.

Many people may wonder why I don't need transfer. The biggest reason is that the title of the transfer page will not change, and the existing mechanism will change a lot if I use transfer.

What should I do? Thank you.

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.