Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我试图理解为什么方法在andInit中都可用,以及何时使用其中一种。HttpApplicationHttpModule
Init
HttpApplication
HttpModule
您只能拥有一个应用程序,但您可以在一个应用程序中拥有多个 HttpModule。模块通常用于处理可以添加到应用程序的单独功能块(很少有现实生活中的示例 - Elmah - 处理错误记录,IdentityModule - 处理模拟等)。由于您可以将相同的模块(比如说错误日志)附加到不同的应用程序(比如说 MyCompany.CRM、MyComany.PublicWeb、MyComany.Intranet),因此它们自己处理初始化是有道理的,取决于您正在添加的应用程序他们到。