RequestNotification Enumeration

 

Indicates when events and other life-cycle events occur while a HttpApplication request is being processed.

This enumeration has a FlagsAttribute attribute that allows a bitwise combination of its member values.

Namespace:   System.Web
Assembly:  System.Web (in System.Web.dll)

<FlagsAttribute>
Public Enumeration RequestNotification

Member nameDescription
AcquireRequestState

Indicates that the AcquireRequestState event was raised for the request and is processing.

AuthenticateRequest

Indicates that the AuthenticateRequest event was raised for the request and is processing.

AuthorizeRequest

Indicates that the AuthorizeRequest event was raised for the request and is processing.

BeginRequest

Indicates that the BeginRequest event was raised for the request and is processing.

EndRequest

Indicates that the EndRequest event was raised for the request and is processing.

ExecuteRequestHandler

Indicates that the handler that is mapped to the requested resource is being invoked to process the request.

LogRequest

Indicates that the LogRequest event was raised for the request and is processing.

MapRequestHandler

Indicates that the MapRequestHandler event was raised for the request and is processing.

PreExecuteRequestHandler

Indicates a point in the application life cycle just before the handler that processes the request is mapped.

ReleaseRequestState

Indicates that the ReleaseRequestState event was raised for the request and is processing.

ResolveRequestCache

Indicates that the ResolveRequestCache event was raised for the request and is processing.

SendResponse

Indicates that processing of the request is complete and that the response is being sent.

UpdateRequestCache

Indicates that the UpdateRequestCache event was raised for the request and is processing.

The RequestNotification enumeration is used with the CurrentNotification property of the HttpContext class to determine what event in the pipeline is currently processing. To determine when all the handlers for a specific event of the HttpApplication instance have finished processing, use the IsPostNotification property.

The RequestNotification type is introduced in the .NET Framework 3.5. For more information, see .NET Framework Versions and Dependencies.

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.

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

.NET Framework
Available since 2.0
Return to top
Show: