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.