Describes how data flows in Asp. Net: HttpRuntime transfers Http requests to HttpApplication, which represents a Web application created by a programmer. HttpApplication creates an HttpContext object for this Http request. These objects contain many other objects related to this request, including HttpRequest, HttpResponse, and HttpSessionState. These objects can be accessed through the Page class or Context class in the program.
Next, the Http request uses a series of modules that have full control over the Http request. These modules can be used before a specific task is executed.
After the Http request passes through all modules, it will be processed by HttpHandler. In this step, perform some actual operations, usually the business logic completed on the. aspx page. You may not understand this process when creating the. aspx Page. However, you must know that the. aspx Page inherits from the Page class. Let's take a look at the Page class signature:
Reference content is as follows: Public class Page: TemplateControl, IHttpHandler { // Code omitted } |
As you can see, the Page class implements the IHttpHandler interface, and HttpHandler is also the lowest layer for Http request processing.
After HttpHandler completes processing, the Http request returns to the Module again. At this time, the Module can do some things that have been completed.
If we focus only on Http requests, HttpHandler and HttpModule, and do not consider HttpContext and HttpApplication, we can simplify it as follows: