HttpRuntime class
The page request first processes the object that can process the original HTTP request, and finally generates the tag to be sent to the browser on the terminal of the pipeline. The HttpRuntime class is the entry point for pipeline change.
For each request, ASP. NET creates an HttpRuntime object and calls ProcessRequest to activate the HTTP pipeline. The HttpRuntime object initializes the internal objects that are used to process page requests. After the ProcessRequest method is called, an HttpContext class instance is created, which encapsulates all the information provided by HTTP. We generally use this HttpContext object in code, it is created by the HttpRuntime object. The HttpRuntime object uses the request information to lock the Web application object that can process the request. The Web application can be located through the virtual path in the URL, but the object of the Web application that actually locks the request is HttpApplicationFactory. Returns valid objects that can process the request. The HttpRuntime object will be an HttpContext object, and then the HttpContext object will be passed to the HttpApplicationFactory object, entrusting her to determine the application that can process the request. In the lifecycle of an application, the HttpApplicationFactory object maintains many HttpApplication objects used to process requests. When the program factory object is called, it verifies whether the requested target virtual folder exists. If the application is running, change the factory to get an HttpApplication object from the available Object pool, then, delegate the request object to it and create it if it does not exist. If the virtual directory has not been called, create an HttpApplication object in the new AppDomain. In this way, if the application file is global. if asax exists, the HttpApplication object needs to be compiled. This process is equivalent to starting the application. The HttpApplication object is used to process page requests. Each time a page request is processed, multiple objects are used to process concurrent requests ).
HttpApplication class
HttpApplication is a base class that represents a running ASP. NET application.
It can also be a derived class of HttpApplication that represents a running ASP. NET application.
If global. asax exists, the source code of the dynamically generated application class will be created,
If global. asax is available, the application class will be created; otherwise, the base class HttpApplication will be used.
The entire lifecycle of an instance management request in an HttpApplication or derived class. After the request is processed, the instance is released to process other requests.
HttpApplication maintains a series of Http module objects that can filter and modify the requested content. During the request process, registered modules may be called at any time. The HttpApplication object can determine the type of the requested resource (pages, controls, etc.), and then use the handler factory to lock the handler object that can process the request. The handler factory object is a class instance that implements the IHttpHandlerFactory interface and is responsible for locking the HTTP handler that can process the request. An ASP. NET page is a processing program object (class instance that implements the IHttpHandler interface ).
Page Factory
The HttpApplication Class determines the object model of the request to be processed, and entrusts the corresponding handler factory of this type to create its new instance. What if a request is a page request?
Once the HttpApplication object is in charge of the request, you must select an appropriate processing program. For page-oriented requests, the factory name is PageHandlerFactory. To find a suitable processing program, HttpApplication reads the information of the <HttpHandlers> section of the configuration file, which contains a major registered processing program. After the request comes over, the page processing factory will create an object instance on the request page. The Page object inherits from the Page class, which implements the IHttpHandler interface. The Page object is returned to the application factory and then returned to the HttpRuntime object. The final step is ASP. NET Runtime Library is complete. The ASP. NET Runtime Library calls the ProcessRequest method of the IHttpHandler Page Object, which enables the page to execute user-defined code and return HTML markup for the browser.
I found a flowchart of the entire pipeline on the website, which is relatively close: