zoukankan      html  css  js  c++  java
  • 关于HttpModule事件顺序和执行顺序

    总的来说,有如下事件会依次触发。

    BeginRequest
    AuthenticateRequest
    AuthorizeRequest
    ResolveRequestCache
    AcquireRequestState
    PreRequestHandlerExecute
    PostRequestHandlerExecute
    ReleaseRequestState
    UpdateRequestCache
    EndRequest
    此外,有三个不确定的顺序:
    PreSendRequestHeaders
    PreSendRequestContent
    Error

    那么,当我们注册了多个Module之后会怎么样呢?

    举个例子:
    如果你在web.config配置了两个HttpModule,分别是HttpModuleA,HttpModuleB
    这个事件执行的顺序如下:
    HttpModuleA->BeginRequest
    HttpModuleB->BeginRequest
    HttpModuleA->AuthenticateRequest
    HttpModuleB->AuthenticateRequest
    HttpModuleA->AuthorizeRequest
    HttpModuleB->AuthorizeRequest
    ...以此类推  

    当然了,系统默认的那些Module总是在自定义Module之前执行

    Framework中默认的Module(C:\windows\microsoft.net\Framework\v2.0.50727\CONFIG\web.config)

        <httpModules>
          <add name="OutputCache" type="System.Web.Caching.OutputCacheModule"/>
          <add name="Session" type="System.Web.SessionState.SessionStateModule"/>
          <add name="WindowsAuthentication" type="System.Web.Security.WindowsAuthenticationModule"/>
          <add name="FormsAuthentication" type="System.Web.Security.FormsAuthenticationModule"/>
          <add name="PassportAuthentication" type="System.Web.Security.PassportAuthenticationModule"/>
          <add name="RoleManager" type="System.Web.Security.RoleManagerModule"/>
          <add name="UrlAuthorization" type="System.Web.Security.UrlAuthorizationModule"/>
          <add name="FileAuthorization" type="System.Web.Security.FileAuthorizationModule"/>
          <add name="AnonymousIdentification" type="System.Web.Security.AnonymousIdentificationModule"/>
          <add name="Profile" type="System.Web.Profile.ProfileModule"/>
          <add name="ErrorHandlerModule" type="System.Web.Mobile.ErrorHandlerModule, System.Web.Mobile, 
    Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
          <add name="ServiceModel" type="System.ServiceModel.Activation.HttpModule, System.ServiceModel, 
    Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
        </httpModules>
  • 相关阅读:
    零基础学Python-第一章 :Python介绍和安装-02.Python的发展历史与版本
    零基础学Python_汇总贴
    零基础学Python-第一章 :Python介绍和安装-01.Python语言的特点
    Spring cloud微服务安全实战-3-11API安全机制之登录
    iOS play video
    Http Live Streaming 实现iphone在线播放视频[转]
    UIWebView分页显示
    ios7适配--uitableviewcell选中效果
    ios7 设置status bar风格
    ios7适配--隐藏status bar
  • 原文地址:https://www.cnblogs.com/chenxizhang/p/1277274.html
Copyright © 2011-2022 走看看