ASP. NET learning Summary: how to handle HTTP requests?

Source: Internet
Author: User


Click to view the chart

  XXX

Create an instance of this class (HttpRuntime) for each request. During instantiation, The HttpRuntime class executes many initialization tasks. The first task is to create a package object, to encapsulate all HTTP-specific information about the request. Then, the newly created object (an instance of the HttpContext class) is passed to the pipeline, and each module is used to access the internal working object (exposed through the attributes of HttpContext), such as: Request, response, Session, and Server. after an HttpContext object is created, HttpRuntime obtains an HttpApplication object to start the application and create an HttpApplication instance. All configured modules are created at the same time. For example, if the application is configured like this, ASP. NET will create a SessionStateModule. After all configured modules are created, the Init method of the HttpApplication class is called. (The process of request processing is started by passing the HttpContext object to the ProcessRequest method that implements the IHttpHandler interface). The process is as follows :)

When processing this request, the HttpApplication class will execute the following events. Developers who want to extend the HttpApplication class should pay special attention to these events.

1. Verify the request, check the information sent by the browser, and determine whether it contains potentially malicious tags. If you have configured any URL in the UrlMappingsSection of the Web. config file, perform URL ing.

2. The BeginRequest event is triggered.

3. Trigger the AuthenticateRequest event.

4. Trigger the PostAuthenticateRequest event.

5. Cause the AuthorizeRequest event.

6. Trigger the PostAuthorizeRequest event.

7. Trigger the ResolveRequestCache event.

8. The PostResolveRequestCache event is triggered.

9. Based on the file extension of the requested resource (ing in the application configuration file), select the class that implements IHttpHandler to process the request. If the request is for an object (Page) derived from the Page class and needs to compile the Page, ASP. NET will compile the Page before creating an instance.

10. Trigger the PostMapRequestHandler event.

11. triggered the AcquireRequestState event.

12. Trigger the PostAcquireRequestState event.

13. Trigger the PreRequestHandlerExecute event.

14. Call the appropriate IHttpHandler class ProcessRequest method (or asynchronous BeginProcessRequest) for this request ). For example, if the request is for a page, the current page instance processes the request.

15. The PostRequestHandlerExecute event is thrown.

16. Trigger the ReleaseRequestState event.

17. The PostReleaseRequestState event is triggered.

18. If the Filter attribute is defined, the response is filtered.

19. The UpdateRequestCache event is triggered.

20. Trigger the PostUpdateRequestCache event.

21. An EndRequest event is triggered.

  • 2 pages in total:
  • Previous Page
  • 1
  • 2
  • Next Page

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.