About Response.Redirect and Response.END Processing Processing Processing Process

xiaoxiao2021-03-06  67

Copyright Notice: 9CBS is this BLOG managed service provider. If this paper involves copyright issues, 9CBS does not assume relevant responsibilities, please contact the copyright owner directly with the article Author.

Sentual Time Motion After deploying to the application server, many users IE will appear .NET "Dahong interface", view the log log, write above: 2003-9-28 17:27:51 481 thread is being stopped . 2003-9-28 17:27:51 481 at System.Threading.Thread.AbortInternal () at System.Threading.Thread.Abort () at System.Threading.Thread.Abort (Object stateInfo) at System.Web.HttpResponse. End () reason is very clear, even when calling response.end, it was aborted by Abort. Later, I found out the relevant information in Microsoft's Support, but Microsoft is a funny reason when giving the problem error: explanation is: This phenomenon is designed to make. Ok, return to the topic, you will definitely use this situation, but Microsoft gives the solution is still good, the following is the content of the link. I have no infringement meaning ~ :)

Symptom

Response.end,

Response.Redirect or

Server.Transfer method,

ThreadAbortException is abnormal. be usable

The TRY-CATCH statement captures this exception.

the reason

Response.end method stops the execution of the page and transforms the execution to the application's event line.

Application_endRequest event.

The code line behind Response.end will not be executed.

This issue appears in

Response.Redirect and

In the server.transfer method, this is because both methods are called internal.

Response.end.

Solution To resolve this issue, use one of the following methods:

For Response.end, call the ApplicationInstance.CompleteRequest method without calling the response.end to skip the code execution of the Application_endRequest event. For Response.Redirect, use the overloaded response.redirect (String Url, Bool EndResponse), which pass false to the endResponse parameter to cancel the internal call to Response.end. For example: Response.Redirect ("NextPage.aspx", False); if you use this solution, the code behind the response.redirect will be executed. For Server.Transfer, use the server.execute method.

This phenomenon is designed to make.

The information in this article applies to:

Microsoft ASP .NET (included in the .NET Framework)

Recent Updated: 2002-1-17 (1.0) Keyword KBDSupport KBerror KbexceptHandling KBGRPDSASP KBPRB KBWEBFORMS KB312629

Microsoft and / or its suppliers do not make any declarations for files published on this server and related to graphics for any purpose. All such files and related graphics are "basically" without any nature guarantee. Microsoft and / or its suppliers here state state statements that all guarantees related to these information is not responsible, including all the default guarantees for the preferred, compliant, ownership, and non-infringement And conditions. In any case, the Microsoft and / or its suppliers caused by loss, data or profits due to loss of use, data or profits due to the use of or running the information on this server or in operation. Special, indirectly or derivative loss or any kind of loss, no responsibility, regardless of the lawsuits, negligence or other infringement. Published on October 11, 2004 5:29 PM

comment

转载请注明原文地址:https://www.9cbs.com/read-90719.html

New Post(0)