Response.End方法 在try...catch语句中执行Response.End()后如何停止执行catch语句中的内容

文章:在try...catch语句中执行Response.End()后如何停止执行catch语句中的内容

调用Response.End()方法能保证,只输出End方法之前的内容。

调用Context.ApplicationInstance.CompleteRequest();方法,会输出方法之后的Response.Write()内容,并且页面的html内容一会被输出。
除非你删除掉页面的html,只保留:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ResponseEnd.aspx.cs" Inherits="TestWebBackThread.ResponseEnd" %>

Context.ApplicationInstance.CompleteRequest()

使 ASP.NET 跳过 HTTP 执行管线链中的所有事件和筛选并直接执行 EndRequest 事件。

猜你喜欢

转载自www.cnblogs.com/Tpf386/p/9946885.html