RequestNotification RequestNotification RequestNotification RequestNotification Enum

Définition

Indique quand des événements et d'autres événements de cycle de vie se produisent au cours du traitement d'une requête HttpApplication.Indicates when events and other life-cycle events occur while a HttpApplication request is being processed.

Cette énumération a un attribut FlagsAttribute qui permet une combinaison au niveau du bit de ses valeurs membres.

public enum class RequestNotification
[System.Flags]
public enum RequestNotification
type RequestNotification = 
Public Enum RequestNotification
Héritage
RequestNotificationRequestNotificationRequestNotificationRequestNotification
Attributs

Champs

AcquireRequestState AcquireRequestState AcquireRequestState AcquireRequestState 32

Indique que l'événement AcquireRequestState a été déclenché pour la requête et effectue le traitement.Indicates that the AcquireRequestState event was raised for the request and is processing.

AuthenticateRequest AuthenticateRequest AuthenticateRequest AuthenticateRequest 2

Indique que l'événement AuthenticateRequest a été déclenché pour la requête et effectue le traitement.Indicates that the AuthenticateRequest event was raised for the request and is processing.

AuthorizeRequest AuthorizeRequest AuthorizeRequest AuthorizeRequest 4

Indique que l'événement AuthorizeRequest a été déclenché pour la requête et effectue le traitement.Indicates that the AuthorizeRequest event was raised for the request and is processing.

BeginRequest BeginRequest BeginRequest BeginRequest 1

Indique que l'événement BeginRequest a été déclenché pour la requête et effectue le traitement.Indicates that the BeginRequest event was raised for the request and is processing.

EndRequest EndRequest EndRequest EndRequest 2048

Indique que l'événement EndRequest a été déclenché pour la requête et effectue le traitement.Indicates that the EndRequest event was raised for the request and is processing.

ExecuteRequestHandler ExecuteRequestHandler ExecuteRequestHandler ExecuteRequestHandler 128

Indique que le gestionnaire qui est mappé sur la ressource demandée est appelé pour traiter la requête.Indicates that the handler that is mapped to the requested resource is being invoked to process the request.

LogRequest LogRequest LogRequest LogRequest 1024

Indique que l'événement LogRequest a été déclenché pour la requête et effectue le traitement.Indicates that the LogRequest event was raised for the request and is processing.

MapRequestHandler MapRequestHandler MapRequestHandler MapRequestHandler 16

Indique que l'événement MapRequestHandler a été déclenché pour la requête et effectue le traitement.Indicates that the MapRequestHandler event was raised for the request and is processing.

PreExecuteRequestHandler PreExecuteRequestHandler PreExecuteRequestHandler PreExecuteRequestHandler 64

Indique un point dans le cycle de vie de l'application, juste avant le mappage du gestionnaire qui traite la requête.Indicates a point in the application life cycle just before the handler that processes the request is mapped.

ReleaseRequestState ReleaseRequestState ReleaseRequestState ReleaseRequestState 256

Indique que l'événement ReleaseRequestState a été déclenché pour la requête et effectue le traitement.Indicates that the ReleaseRequestState event was raised for the request and is processing.

ResolveRequestCache ResolveRequestCache ResolveRequestCache ResolveRequestCache 8

Indique que l'événement ResolveRequestCache a été déclenché pour la requête et effectue le traitement.Indicates that the ResolveRequestCache event was raised for the request and is processing.

SendResponse SendResponse SendResponse SendResponse 536870912

Indique que le traitement de la requête est terminé et que la réponse est en cours d'envoi.Indicates that processing of the request is complete and that the response is being sent.

UpdateRequestCache UpdateRequestCache UpdateRequestCache UpdateRequestCache 512

Indique que l'événement UpdateRequestCache a été déclenché pour la requête et effectue le traitement.Indicates that the UpdateRequestCache event was raised for the request and is processing.

Exemples

L’exemple suivant montre comment utiliser l' RequestNotification énumération avec la CurrentNotification propriété pour déterminer l’événement de l’instance actuelle HttpApplication qui traite la requête.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.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

Remarques

L' RequestNotification énumération est utilisée avec CurrentNotification la propriété de HttpContext la classe pour déterminer quel événement dans le pipeline est en cours de traitement.The RequestNotification enumeration is used with the CurrentNotification property of the HttpContext class to determine what event in the pipeline is currently processing. Pour déterminer à quel moment le traitement de tous les gestionnaires pour un HttpApplication événement spécifique de l’instance est terminé IsPostNotification , utilisez la propriété.To determine when all the handlers for a specific event of the HttpApplication instance have finished processing, use the IsPostNotification property.

Le RequestNotification type est introduit dans le .NET Framework 3.5.NET Framework 3.5.The RequestNotification type is introduced in the .NET Framework 3.5.NET Framework 3.5. Pour plus d’informations, consultez Versions et dépendances.For more information, see Versions and Dependencies.

S’applique à

Voir aussi