HTTPModule Event Execution Order?
Does anyone know of a site or page, or know the order of execution for the events of the HTTPApplication class for HTTPModule event execution?
I found the MSDN Documentation for all of the events, but it doesn't show a list of process steps and I haven't been able to find one.
Solution 1:
Maybe this helps
http://support.microsoft.com/kb/307985/en-us/
An HttpApplication class provides a number of events with which modules can synchronize. The following events are available for modules to synchronize with on each request. These events are listed in sequential order:
- BeginRequest
- AuthenticateRequest
- AuthorizeRequest
- ResolveRequestCache
- AcquireRequestState
- PreRequestHandlerExecute
- PostRequestHandlerExecute
- ReleaseRequestState
- UpdateRequestCache
- EndRequest
The following events are available for modules to synchronize with for each request transmission. The order of these events is non-deterministic.
- PreSendRequestHeaders
- PreSendRequestContent
- Error
See the article for full info.
Solution 2:
MSDN Library documentation:
- ASP.NET Application Life Cycle Overview for IIS 5.0 and 6.0
- ASP.NET Application Life Cycle Overview for IIS 7.0
Here are the events (in bold) and other steps in the request pipeline for ASP.NET 4.0:
- Validate the request, which examines the information sent by the browser and determines whether it contains potentially malicious markup.
- Perform URL mapping, if any URLs have been configured in the UrlMappingsSection section of the Web.config file.
- Raise the BeginRequest event.
- Raise the AuthenticateRequest event.
- Raise the PostAuthenticateRequest event.
- Raise the AuthorizeRequest event.
- Raise the PostAuthorizeRequest event.
- Raise the ResolveRequestCache event.
- Raise the PostResolveRequestCache event.
- [IIS 5.0/6.0] Based on the file name extension of the requested resource (mapped in the application's configuration file), select a class that implements IHttpHandler to process the request. If the request is for an object (page) derived from the Page class and the page needs to be compiled, ASP.NET compiles the page before creating an instance of it. [IIS 7.0] Raise the MapRequestHandler event. An appropriate handler is selected based on the file name extension of the requested resource. The handler can be a native-code module such as the IIS 7.0 StaticFileModule or a managed-code module such as the PageHandlerFactory class (which handles .aspx files).
- Raise the PostMapRequestHandler event.
- Raise the AcquireRequestState event.
- Raise the PostAcquireRequestState event.
- Raise the PreRequestHandlerExecute event.
- Call the ProcessRequest method (or the asynchronous version IHttpAsyncHandler.BeginProcessRequest) of the appropriate IHttpHandler class for the request. For example, if the request is for a page, the current page instance handles the request.
- Raise the PostRequestHandlerExecute event.
- Raise the ReleaseRequestState event.
- Raise the PostReleaseRequestState event.
- Perform response filtering if the Filter property is defined.
- Raise the UpdateRequestCache event.
- Raise the PostUpdateRequestCache event.
- [IIS 7.0] Raise the LogRequest event.
- [IIS 7.0] Raise the PostLogRequest event.
- Raise the EndRequest event.
- Raise the PreSendRequestHeaders event.
- Raise the PreSendRequestContent event.
Note: The MapRequestHandler, LogRequest, and PostLogRequest events are supported only if the application is running in Integrated mode in IIS 7.0 and with the .NET Framework 3.0 or later.