假设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相关问答推荐

内容根路径在 .NET 6 中如何工作?

在这个 For 循环计数没有增加

Server.Transfer 在执行子请求时抛出错误.如何解决?

将 ListItem 的 ASP.NET 列表数据绑定到 DropDownList 问题

如何在 ASP.Net Core Razor 页面上重定向

System.Web.MVC 自 MS14-059 以来未复制到 bin 文件夹中.如何防止由于 Windows 更新而创建缺少 DLL 的构建?

如何从 Asp.net Mvc-3 发送邮箱?

ASP.NET 中的全局资源与本地资源

单独装配和路由中的控制器

有条件地排除 ASP.NET WebForms 中的一个 html 块

SignalR /signalr/hubs 404 未找到

c# list 如何在两个值之间插入一个新值

为什么混合 Razor Pages 和 VueJs 是一件坏事?

捕获的异常本身为 null !

ContentResult 与字符串

简单的 LINQ 和列表错误:WhereListIterator`1[Task]' to type 'System.Collections.Generic.List`1[Task]'

ASP.NET 5 (vNext) - 获取配置设置

为什么 IFormFile 显示为空,我该如何解决?

ASP.NET 邮箱验证器正则表达式

ASP.NET MVC3 局部视图命名约定