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

标签 asp.net web-config httpmodule

假设FirstModuleSecondModule都处理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>

关于asp.net - 如何确定HttpModules的执行顺序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2427451/

相关文章:

ASP.NET HttpModule 在浏览器中给出 "Connection Reset"

c# - ASP.NET HttpModules 和 Server.Transfer/Server.TransferRequest/RewritePath 问题

c# - 使用 ASP.NET MVC 5 和 DocumentDB 执行登录操作

c# - 自定义控件的绑定(bind)在 GridView 中有效,但在 FormView 中无效

asp.net - 从共享驱动器托管的网站中特定于服务器的 web.config

c# - 如何在每次 IIS 重新启动时执行一些代码

asp.net - 修改特定 gridview 列的数据行值

asp.net - IIS 7.5 中未启用 Windows 身份验证

c#-3.0 - 如何使用物理路径OpenWebConfiguration?

c# - Elmah 不使用 MVC 3 的 gmail