Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.


Channels ▼
RSS

.NET

The Entry-Point in the ASP.NET System


A full understanding of the HTTP runtime is essential to making sense of internal ASP.NET processes and therefore possible extensions. For example, ASP.NET AJAX is a set of extensions bolted on the HTTP runtime and fully integrated with it. Let's briefly recap the key elements of the ASP.NET runtime.

A full understanding of the HTTP runtime is essential to making sense of internal ASP.NET processes and therefore possible extensions. For example, ASP.NET AJAX is a set of extensions bolted on the HTTP runtime and fully integrated with it. Let's briefly recap the key elements of the ASP.NET runtime.

When an ASP.NET request hits the Web server, it is forwarded to the worker process that hosts and runs the application. The specifics of the worker process change with the version of IIS installed and the selected process model. In a scenario with Windows 2000 Server as the server operating system, the worker process is aspnet_wp.exe, an executable installed with ASP.NET. With Windows 2003 Server and Windows Vista, the worker process is a constituent part of the system and is named w3wp.exe. Windows Vista is a user system, and it is not designed to run server applications. But it is equipped with the newest version of IIS. IIS 7.0 in Windows Vista is feature complete, and aside from parameters such as supported number of connections and users, is equivalent to the version of IIS 7.0 that will ship with the upcoming Windows 2008 Server (codenamed Windows Longhorn Server).

The worker process initializes the Common Language Runtime and passes any incoming ASP.NET requests to the so-called "HTTP pipeline." The detailed steps of how this happens are specific of the worker process and the process model in use.

The HTTP pipeline is a fully extensible chain of managed objects that works according to the classic concept of a pipeline. The original HTTP payload enters in one end of the pipeline and, at the end produces some markup code for the browser. The entry point in this pipeline is the HttpRuntime class. The ASP.NET worker process activates the HTTP pipeline by creating a new instance of the HttpRuntime class and then calling its ProcessRequest method.

Upon creation, the HttpRuntime object initializes a number of internal objects that will carry out the page request. Helper objects include the cache manager and the file system monitor used to detect changes in the source files of the application. In addition, the HttpRuntime object creates a new context for the request and initializes a specialized text writer object in which the markup code will be accumulated. A context is given by an instance of the HttpContext class, which encapsulates all HTTP-specific information about the request. This HttpContext object accompanies the request for its whole lifetime.

The runtime's next step is finding out a Web application object capable of processing the request. This object is an instance of a class derived from HttpApplication. In most cases, the class is dynamically built from the contents of the application's global.asax file. This object is responsible for locating the HTTP handler component for the request-that is the class that will physically produce the response for the browser. A HTTP handler is a class that implements the IHttpHandler interface; the System.Web.UI.Page class is the most complex handler of the whole ASP.NET platform.

The ASP.NET developer is responsible for writing the page class-both markup and code-behind logic-and this closes the circle. The output for the page is returned to HttpRuntime and from there served to the user.


Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.