HTTP Module and HTTP Handler of Asp. Net

Source: Internet
Author: User


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:

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.