Skip to content

IIS 7 / ASP.NET processing stages

26 April 2011

When using Integrated mode for IIS 7 applications, ASP.NET request-processing stages are directly connected to the corresponding stages of the IIS 7 pipeline. Unlikely to IIS 6 (more info at ASP.NET Application Life Cycle Overview for IIS 5.0 and 6.0), where there were two request processing pipelines IIS 7 has one unified request processing pipeline for all requests. Processing goes through different stages that are available as HttpApplication events in ASP.NET. This allows tasks, that were available through native ISAPI filters and extensions, to be accessible now in managed code by executing them in the same stages as IIS 7 modules.

This stages are:

  1. Validate the request. Request validation is performed by comparing all input data to a list of potentially dangerous values.
  2. URL mapping.  If Web.config has configured UrlMappingsSection section.
  3. BeginRequest. The request processing starts.
  4. AuthenticateRequest. IIS 7 and ASP.NET authentication modules subscribe to this stage to perform authentication.
  5. PostAuthenticateRequest.
  6. AuthorizeRequest. IIS 7 and ASP.NET authorization modules check whether the authenticated user has access to the resource requested.
  7. PostAuthorizeRequest.
  8. ResolveRequestCache. Check and return cached response (if exists) to this request instead of proceeding execution path. Executed both ASP.NET Output Cache and IIS 7 Output Cache.
  9. PostResolveRequestCache.
  10. MapRequestHandler. This is used to determine the request handler ( internal in ASP.NET).
  11. PostMapRequestHandler.
  12. AcquireRequestState. The execution request state is retrieved.  (ASP.NET Session State and Profile modules obtain their data).
  13. PostAcquireRequestState.
  14. PreExecuteRequestHandler. Any tasks pre handler execution are performed.
  15. ExecuteRequestHandler. The request handler executes. (ASPX, ASP pages, CGI programs, and static files are served).
  16. PostExecuteRequestHandler
  17. ReleaseRequestState. The request state changes are saved, and the state is cleaned up here. (ASP.NET Session State & Profile cleanup happens here.)
  18. PostReleaseRequestState.
  19. UpdateRequestCache. The ASP.NET Output Cache and IIS 7 Output Cache modules execute to save the response to their caches for future use.
  20. PostUpdateRequestCache.
  21. LogRequest. This stage logs the request’s results. It is guaranteed to execute even if errors occur.
  22. PostLogRequest.
  23. EndRequest. Final request cleanup. Execution is guaranteed even if errors occur.

These events are useful for implementing code that should response when request pipeline events are raised. They are also useful if a custom module that  implements the IHttpModule has to be invoked for all requests to the pipeline. In Integrated mode in IIS 7.0, event handlers must be registered in a module’s Init method.

Advertisements

From → IIS7

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: