假設FirstModule
和SecondModule
都處理Application_BeginRequest
事件。它會按照web.config中定義的順序執行嗎?如何確定HttpModules的執行順序?
<httpModules>
<add type="MyApp.FirstModule, MyApp" name="FirstModule"/>
<add type="MyApp.SecondModule, MyApp" name="SecondModule"/>
<add type="OtherApp.OtherModule, OtherApp" name="OtherModule"/>
</httpModules>
是否有其他方式可以指定訂單?
有人在論壇帖子中說過。但是有幾個人也說過你不應該依賴它。 – jessegavin 2010-03-11 19:04:51
不應該依賴於它是的,不是因爲它不起作用,而是因爲設計考慮和促進模塊之間的鬆散耦合。但是不存在模塊排序與配置文件中的排序不同的情況。希望這可以幫助。 – 2010-03-22 08:40:26
看起來您可以訂購它們,但訂購似乎已鎖定,您必須解鎖條目以影響實際訂購。 – jamiebarrow 2011-08-17 14:53:01