ASP.NET Page Object Model
Release Date: 4/1/2004
| Update Date: 4/1/2004
ASP.NET Web page life history
Dino Esposito Wintelle
August 2003
Applicable to: Microsoft ASP.NET
Summary: Understand the event model constructed around the ASP.NET web page, and a web page transitions to HTML. ASP.NET HTTP runtime control object line, the object line first converts the requested URL into a page class activity instance, and then converts it to a normal HTML text. This article will explore various feature events in the survival cycle of the page, and understand how controls and page writers involve it to change their standard behavior. (6 page print pages)
This page
Introduction The true Page class survival period execution of each stage summary
Introduction
The Microsoft Internet Information Services (IIS) receives each request for a Microsoft ASP.NET page to the ASP.NET HTTP pipeline. The HTTP line consists of a series of managed objects that handle the request in order and complete the conversion from the URL to the ordinary HTML text. The entry point of the HTTP pipeline is the HTTPRuntime class. ASP.NET infrastructure creates an instance of each AppDomain carried in the auxiliary process (note that the auxiliary process maintains a different appdomain) for each ASP.NET application currently running.
The HTTPRuntime class selects an HttPApplication object from the internal pool and let it process the request. The main task of the HTTP Application Manager is to identify classes that will actually process the request. If the .aspx resource is requested, the handler is a page handler - one instance of a class inherited from the class. The association between resource type and handler type is stored in the configuration file of the application. More precisely, define a default set of mapping relationships in the
The extension can be associated with a handler class, or more universally associated into a Handler Factory class. In all cases, the HTTPApplication object that is responsible for processing the request will get an object that implements the IHTTPHANDLER interface. If the associated resource / class is parsed according to the HTTP handler, the returned class will directly implement the interface. Another step is required if the resource is bind to the handler factory. The processor factory class implements the IHTTPHANDLERFAACTORY interface, and the interface's GetHandler method returns an object based on IHTTPHANDLER.
How can HTTP runtime complete the entire loop and handle the page request? The IHTTPHANDLER interface specially provides the ProcessRequest method. This method is called by an object that represents the requested page, the ASP.NET infrastructure launches the corresponding process to generate an output for the browser.
Back to top
Real Page class
The HTTP handler type of a particular page depends on the URL. When the URL is called for the first time, a new class will be built and the class is dynamically compiled into an assembly. The output result of the syntax analysis process for checking the .aspx source is the source code for this class. This class is defined as part of the ASP namespace and is given a similar name similar to the original URL. For example, if the URL endpoint is Page.ASPX, the class name is ASP.PAGE_ASPX. However, you can also control the name of the class by programming the ClassName property of the @PAGE instruction. The base class of the HTTP handler is Page. This class defines the minimum collection of methods and properties shared by all page handles. The IHTTPHANDLER interface is implemented in the page class.
In some cases, the base class of the actual handler is not Page, but a different class. For example, this happens if you use code hidden. The code is hidden is a development method that encapsulates the code required to a separate C # or Microsoft Visual Basic.net class. The page of the page is a set of event handlers and help methods to actually create the behavior of this page. This code can be defined as an inline code using the