HttpModule及其中的事件的执行顺序
HttpModule执行的顺序取决于web.config配置HttpModule的顺序,而HttpModule中事件的执行先后顺序与asp.net运行机制相关,具体执行顺序如下:
BeginRequest
AuthenticateRequest
AuthorizeRequest
ResolveRequestCache
AcquireRequestState
PreRequestHandlerExecute
PostRequestHandlerExecute
ReleaseRequestState
UpdateRequestCache
EndRequest
此外,有三个不确定的顺序:
PreSendRequestHeaders
PreSendRequestContent
Error
举个例子:
如果你在web.config配置了两个HttpModule,分别是HttpModuleA,HttpModuleB
这个事件执行的顺序如下:
HttpModuleA->BeginRequest
HttpModuleB->BeginRequest
HttpModuleA->AuthenticateRequest
HttpModuleB->AuthenticateRequest
HttpModuleA->AuthorizeRequest
HttpModuleB->AuthorizeRequest
...以此类推
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/flashlm/archive/2008/01/19/2053387.aspx