Monday, January 5, 2009

Understanding the ASP.NET Architecture - Part1

ASP.NET is built with an extensible architecture that provides excellent performance and a logical approach to servicing client requests. The ASP.NET runtime engine delegates client requests to a wide variety of handler classes. Client requests are not serviced by a monolithic process but are instead routed to targeted classes designed to service a specific kind of request.

For example, when a client calls up an *.aspx page in their browser, the request gets routed from the ASP.NET runtime engine to a specialized factory class that receives the request and returns a Page object.
This object can be manipulated on the server as needed before it is rendered on the browser as HTML.

Like a corporate chief executive officer (CEO), the HttpRuntime instance is ultimately accountable for servicing a client request, but it does so by delegating the work to handler classes.

Figure 1 provides a schematic view of ASP.NET architecture.

The role of IIS is relatively diminished in ASP.NET compared to classic ASP. Specifically, the role of IIS (in ASP.NET) is primarily relegated to that of a request/response broker. IIS is the point of first contact for incoming client requests, and it will run authentication checks before allowing requests to proceed.

At a minimum, IIS simply accepts an anonymous client request and assigns it to the default local machine account that has been created for IIS (IUSR_[Machine Name]).

Alternatively, you can configure the Web site to use Windows-based authentication, in which case IIS will demand specific credentials from the client.

Either way, once IIS has performed its authentication checks, it forwards the client request to a dedicated process called the ASP.NET worker process (aspnet_wp.exe).

This process executes a number of steps that culminate in passing the client request to the ASP.NET runtime engine.



Figure 1: ASP.NET Web site architecture

The ASP.NET runtime engine contains a set of classes for handling client requests and serving responses. These classes provide the basic infrastructure and the core capabilities for supporting Web applications. The gateway to the runtime engine is the HttpRuntime class.

This class initially accepts a client request and then delegates it to any number of HTTP handler classes, depending on the nature of the request. Figure 1 depicts incoming HTTP requests from Web clients that get filtered down to the HTTP runtime engine (shown as solid lines).

The HTTP request then gets delegated to several HTTP handler classes, including the PageHandlerFactory class, which is responsible for generating a Page object. The Page object receives a reference to the HTTP request object and begins processing the request.

Finally, the Page object renders an HTML response that gets filtered back to the Web clients (shown as dashed lines). The figure also represents the close ties between the HTTP runtime engine and the underlying .NET Framework on which it is built.

Quoted.

No comments:

Post a Comment