HttpContext.IsPostNotification 속성
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
이벤트가 처리를 완료한 직후 ASP.NET 파이프라인의 현재 처리 지점인 HttpApplication 값을 가져옵니다.
public:
property bool IsPostNotification { bool get(); };
public bool IsPostNotification { get; }
member this.IsPostNotification : bool
Public ReadOnly Property IsPostNotification As Boolean
속성 값
예외
이 작업을 수행하려면 IIS 7.0 및 .NET Framework 3.0 이상의 통합 파이프라인 모드가 필요합니다.
예제
다음 예제에서는 속성을 사용 하 여 IsPostNotification 개체의 HttpApplication 이벤트가 모든 관련 된 이벤트 처리기 처리를 완료 하는 경우를 확인 하는 방법을 보여 줍니다. 이 예제의 사용자 지정 이벤트 처리기는 개체의 HttpApplication 여러 이벤트를 처리하고 IsPostNotification 속성은 특정 이벤트가 처리된 후 호출되는 코드를 결정하는 데 사용됩니다.
using System;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
// Module that demonstrates one event handler for several events.
namespace Samples
{
public class ModuleExampleTestCS : IHttpModule
{
public ModuleExampleTestCS()
{
// Constructor
}
public void Init(HttpApplication app)
{
app.AuthenticateRequest += new EventHandler(App_Handler);
app.PostAuthenticateRequest += new EventHandler(App_Handler);
app.LogRequest += new EventHandler(App_Handler);
app.PostLogRequest += new EventHandler(App_Handler);
}
public void Dispose()
{
}
// One handler for AuthenticationRequest, PostAuthenticateRequest,
// LogRequest, and PostLogRequest events
public void App_Handler(object source, EventArgs e)
{
HttpApplication app = (HttpApplication)source;
HttpContext context = app.Context;
if (context.CurrentNotification == RequestNotification.AuthenticateRequest)
{
if (!context.IsPostNotification)
{
// Put code here that is invoked when the AuthenticateRequest event is raised.
}
else
{
// PostAuthenticateRequest
// Put code here that runs after the AuthenticateRequest event completes.
}
}
if (context.CurrentNotification == RequestNotification.LogRequest)
{
if (!context.IsPostNotification)
{
// Put code here that is invoked when the LogRequest event is raised.
}
else
{
// PostLogRequest
// Put code here that runs after the LogRequest event completes.
}
}
}
}
}
Imports System.Data
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
' Module that demonstrates one event handler for several events.
Namespace Samples
Public Class ModuleExampleTestVB
Implements IHttpModule
Public Sub New()
' Constructor
End Sub
Public Sub Init(ByVal app As HttpApplication) Implements IHttpModule.Init
AddHandler app.AuthenticateRequest, AddressOf Me.App_Handler
AddHandler app.PostAuthenticateRequest, AddressOf Me.App_Handler
AddHandler app.LogRequest, AddressOf Me.App_Handler
AddHandler app.PostLogRequest, AddressOf Me.App_Handler
End Sub
Public Sub Dispose() Implements IHttpModule.Dispose
End Sub
' One handler for AuthenticationRequest, PostAuthenticateRequest,
' LogRequest, and PostLogRequest events
Public Sub App_Handler(ByVal source As Object, ByVal e As EventArgs)
Dim app As HttpApplication = CType(source, HttpApplication)
Dim context As HttpContext = app.Context
If (context.CurrentNotification = RequestNotification.AuthenticateRequest) Then
If Not (context.IsPostNotification) Then
' Put code here that is invoked when the AuthenticateRequest event is raised.
Else
' PostAuthenticateRequest
' Put code here that runs after the AuthenticateRequest event completes.
End If
End If
If (context.CurrentNotification = RequestNotification.LogRequest) Then
If Not (context.IsPostNotification) Then
' Put code here that is invoked when the LogRequest event is raised.
Else
' PostLogRequest
' Put code here that runs after the LogRequest event completes.
End If
End If
End Sub
End Class
End Namespace
설명
이 IsPostNotification 속성은 IIS 7.0 및 .NET Framework 3.0 이상의 통합 모드에서만 지원됩니다. 사용 가능한 경우 속성은 개체의 이벤트가 HttpApplication 처리를 완료했는지 여부를 나타내는 부울 값을 반환합니다.
속성을 IsPostNotification 설정할 수 없습니다. 대신 IIS 7.0에서 각 알림에 대한 ASP.NET 런타임에 제공됩니다. IsPostNotification 속성을 설정하면 컴파일 오류가 발생합니다.
하나의 이벤트 처리기에서 개체의 HttpApplication 여러 이벤트를 처리하는 시나리오에서는 열거형과 함께 RequestNotification 속성을 사용하여 IsPostNotification 애플리케이션 수명 주기에서 현재 요청이 어디에 있는지 정확하게 확인할 수 있습니다.
IsPostNotification 는 .NET Framework 버전 3.5에 도입되었습니다. 자세한 내용은 버전 및 종속성을 참조하세요.