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

xiaoxiao2021-03-06  92

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

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

New Post(0)