ASP.NET: Request Architecture (Internal)


This article gives insight on how ASP.Net request is processed once it's been issued from the browser. It also provide some basic information about the components involved in this whole request processing architecture.

ASP.NET: Request Architecture (Internal)




Step1: A request is issued from the browser


For ex: user types www.google.com in address bar, after this request reaches to the server in which this site is hosted.

User types URL in address bar ------> request is issued to browser


Step2: Kernel mode http.sys picks up the request


Once the request reached IIS, it is picked up by the kernel mode http.sys driver.

Q:kernel mode http.sys driver?
When IIS creates any site, it gets registerd with kernel mode http.sys driver, which then receives all the request for this site.

Request from browser -------> http.sys picks up the request


Step3: Request is forwarded to the application pool


kernel mode process (http.sys) ------> redirects request to user mode process(w3wp.exe worker process)

Note: Each webapplication runs unders a application pool which inturn is managed by an instance of worker process.


Step4: Worker process loads the ASP.NET ISAPI extension


ISAPI extensions are the IIS way to handle the request for different resources. Worker process looks into the requested URL to load the correct ISAPI extension. ASP.NET installs its own ISAPI extension (aspnet_isapi.dll) and adds the mapping in IIS. Since .aspx extension is mapped to aspnet_isapi.dll extesnion, worker process passes the request to aspnet_isapi extension.

aspnet_isapi extension -------> loads the http runtime to start the request processing

The request has passed from the browser to http.sys, which in turn passed the request to the application pool. The worker process which is running the application pool investigates the URL of the request, and uses the IIS application extension mapping to load up the ASP.NET ISAPI "aspnet_isapi.dll". The ASP.NET ISAPI will now load the HTTP Runtime, which is also called the ASP.NET Runtime. The HTTP Runtime creates an HttpContext and associates the request with an HttpApplication. The request passes through the HTTP Pipeline
HTTP Modules are executed against the request until the request hits the ASP.NET page HTTP Handler. Once the request leaves the HTTP Pipeline, the Page life cycle starts.


Step5: Inside HTTP runtime


* Loads the HttpRuntime class
* HttpRuntime.ProcessRequest method signals the start of the processing
* A new instance of HttpContext in created for the request. HttpContext represents the context of the currently active request. HttpContext is accessible throughout the lifespan of the request and can be accessed using HttpContext.Current property.


Comments

Guest Author: Siby13 Oct 2012

Nice article



  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: