加入收藏 | 设为首页 | 会员中心 | 我要投稿 安卓应用网 (https://www.0791zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

asp.net – 如何确定HttpModules的执行顺序?

发布时间:2020-05-23 07:41:20 所属栏目:asp.Net 来源:互联网
导读:假设FirstModule和SecondModule都处理Application_BeginRequest事件。它将按照web.config中定义的顺序执行吗? httpModules add type=MyApp.FirstModule, MyApp name=FirstModule/ add type=MyApp.SecondModule, MyApp name=

假设FirstModule和SecondModule都处理Application_BeginRequest事件。它将按照web.config中定义的顺序执行吗?

<httpModules>
  <add type="MyApp.FirstModule,MyApp" name="FirstModule"/>
  <add type="MyApp.SecondModule,MyApp" name="SecondModule"/>
  <add type="OtherApp.OtherModule,OtherApp" name="OtherModule"/>
</httpModules>

有没有其他方法可以指定订单?

解决方法

根据 this forum post,HttpModules按照它们被注册的顺序执行。这对我有意义,因为否则的话< clear>和< remove>指令也不会按预期工作,例如。当使用这样:
<httpModules> 
   <clear/>
   <add... />
</httpModules>

(编辑:安卓应用网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读