2013-07-08 19 views
0

在我的web.config <system.webServer>部分添加我的自定義模塊:WebPageHttpModule是如何在我的模塊後註冊的?

<modules> 
    <add name="MyCustomModule" type="MyAssembly.MyCustomModule, MyAssembly" /> 
</modules> 

,然後在我的HTTP處理程序我遍歷模塊列表:

var allModules = HttpContext.Current.ApplicationInstance.Modules; 
for(int i = 0; i < allModules.Count; i++) { 
    Trace(allModules.GetKey(i)); 
} 

,我得到這個名單:

__ASP_IntegratedDynamicModule_Shim 
OutputCache 
Session 
FormsAuthentication 
DefaultAuthentication 
RoleManager 
AnonymousIdentification 
Profile 
UrlMappingsModule 
ServiceModel-4.0 
UrlRoutingModule-4.0 
ScriptModule-4.0 
MyCustomModule <<<<<<<<<<<<<My Module 
__DynamicModule_System.Web.WebPages.WebPageHttpModule, System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35_2d022434-c92d-4088-bfa6-3478c4fc129d 

很明顯,我的模塊是在所有內置模塊之後註冊的,除了WebPageHttpModule是在它之後註冊的。

這是怎麼發生的?我怎麼可能確保我自己的模塊最後被註冊?

回答

相關問題