RequestNotification
RequestNotification
RequestNotification
RequestNotification
Enum
정의
HttpApplication 요청이 처리되는 동안 이벤트 및 다른 수명 주기 이벤트가 발생하는 경우를 나타냅니다.Indicates when events and other life-cycle events occur while a HttpApplication request is being processed.
이 열거형에는 멤버 값의 비트 조합을 허용하는 FlagsAttribute 특성이 있습니다.
public enum class RequestNotification
[System.Flags]
public enum RequestNotification
type RequestNotification =
Public Enum RequestNotification
- 상속
- 특성
필드
AcquireRequestState AcquireRequestState AcquireRequestState AcquireRequestState | 32 | 요청에 대해 AcquireRequestState 이벤트가 발생하여 처리 중임을 나타냅니다.Indicates that the AcquireRequestState event was raised for the request and is processing. |
AuthenticateRequest AuthenticateRequest AuthenticateRequest AuthenticateRequest | 2 | 요청에 대해 AuthenticateRequest 이벤트가 발생하여 처리 중임을 나타냅니다.Indicates that the AuthenticateRequest event was raised for the request and is processing. |
AuthorizeRequest AuthorizeRequest AuthorizeRequest AuthorizeRequest | 4 | 요청에 대해 AuthorizeRequest 이벤트가 발생하여 처리 중임을 나타냅니다.Indicates that the AuthorizeRequest event was raised for the request and is processing. |
BeginRequest BeginRequest BeginRequest BeginRequest | 1 | 요청에 대해 BeginRequest 이벤트가 발생하여 처리 중임을 나타냅니다.Indicates that the BeginRequest event was raised for the request and is processing. |
EndRequest EndRequest EndRequest EndRequest | 2048 | 요청에 대해 EndRequest 이벤트가 발생하여 처리 중임을 나타냅니다.Indicates that the EndRequest event was raised for the request and is processing. |
ExecuteRequestHandler ExecuteRequestHandler ExecuteRequestHandler ExecuteRequestHandler | 128 | 요청을 처리하기 위해 요청된 리소스에 매핑된 처리기를 호출하고 있음을 나타냅니다.Indicates that the handler that is mapped to the requested resource is being invoked to process the request. |
LogRequest LogRequest LogRequest LogRequest | 1024 | 요청에 대해 LogRequest 이벤트가 발생하여 처리 중임을 나타냅니다.Indicates that the LogRequest event was raised for the request and is processing. |
MapRequestHandler MapRequestHandler MapRequestHandler MapRequestHandler | 16 | 요청에 대해 MapRequestHandler 이벤트가 발생하여 처리 중임을 나타냅니다.Indicates that the MapRequestHandler event was raised for the request and is processing. |
PreExecuteRequestHandler PreExecuteRequestHandler PreExecuteRequestHandler PreExecuteRequestHandler | 64 | 요청을 처리하는 처리기 바로 앞에 있는 애플리케이션 수명 주기의 지점이 매핑됨을 나타냅니다.Indicates a point in the application life cycle just before the handler that processes the request is mapped. |
ReleaseRequestState ReleaseRequestState ReleaseRequestState ReleaseRequestState | 256 | 요청에 대해 ReleaseRequestState 이벤트가 발생하여 처리 중임을 나타냅니다.Indicates that the ReleaseRequestState event was raised for the request and is processing. |
ResolveRequestCache ResolveRequestCache ResolveRequestCache ResolveRequestCache | 8 | 요청에 대해 ResolveRequestCache 이벤트가 발생하여 처리 중임을 나타냅니다.Indicates that the ResolveRequestCache event was raised for the request and is processing. |
SendResponse SendResponse SendResponse SendResponse | 536870912 | 요청의 처리가 완료되어 응답이 전송되고 있음을 나타냅니다.Indicates that processing of the request is complete and that the response is being sent. |
UpdateRequestCache UpdateRequestCache UpdateRequestCache UpdateRequestCache | 512 | 요청에 대해 UpdateRequestCache 이벤트가 발생하여 처리 중임을 나타냅니다.Indicates that the UpdateRequestCache event was raised for the request and is processing. |
예제
다음 예제에서는 사용 하는 방법을 보여 줍니다 합니다 RequestNotification 인 열거형 합니다 CurrentNotification 현재 이벤트를 확인 하는 속성 HttpApplication 인스턴스는 요청을 처리 합니다.The following example shows how to use the RequestNotification enumeration with the CurrentNotification property to determine which event of the current HttpApplication instance is processing the request.
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
Imports System.Data
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports Microsoft.VisualBasic
' 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
설명
RequestNotification 열거형을 사용 하 여 사용 합니다 CurrentNotification 의 속성은 HttpContext 파이프라인에서 어떤 이벤트가 현재 처리 중인 확인 하려면 클래스.The RequestNotification enumeration is used with the CurrentNotification property of the HttpContext class to determine what event in the pipeline is currently processing. 시기를 결정 하의 특정 이벤트에 대 한 모든 처리기를 HttpApplication 인스턴스 처리를 완료 한, 사용 된 IsPostNotification 속성.To determine when all the handlers for a specific event of the HttpApplication instance have finished processing, use the IsPostNotification property.
합니다 RequestNotification 형식에 도입 된는 .NET Framework 3.5.NET Framework 3.5합니다.The RequestNotification type is introduced in the .NET Framework 3.5.NET Framework 3.5. 자세한 내용은 버전 및 종속성을 참조하세요.For more information, see Versions and Dependencies.