ASP. NET pipeline Processing

Source: Internet
Author: User

When a user sends an ASP. NET Request, the programs processed by ASP. NET after being filtered by iis isapi include. aspx. ascx. ashx and. asmx.
When ASP. when NET receives the first request to any resource in the application, the ApplicationManager class creates an application domain (ASP. NET to a virtual directory for the application, web. config is the directory of the application, and the application domain is used to isolate global variables between programs, and each application can be detached separately, the application domain is the partition where one or more applications reside in an operating system.) (public sealed class ApplicationManger: externalbyrefobject)
ApplicationManager objects provide object lifetime management in the host environment of ASP. NET applications. They are responsible:
1. Activate and initialize ASP. NET applications.
2. Manage the lifetime of the application and the lifetime of the objects registered in the application.
3. Expose the objects used by the host environment to process ASP. NET application requests.
4. provides a list of applications running on the host in the process at any given time.
 
In the application domain, create an instance for the HostingEnvironment class, which provides access to information about the application (such as the name of the folder where the application is stored.

After an application domain is created and the HostingEnviroment object is instantiated, ASP is created for each request. NET core object, if HttpContext, HttpRequest, HttpResponse. after all core application objects are initialized, the application starts by creating an instance of the HttpApplication class. if the application has a Global. ASP. NET will create Global. an instance of asa (derived from the HttpApplication class) and uses this derived class to represent the application. (Request ASP. to improve the performance, you can reuse HttpApplication instances for multiple requests, all configured modules will be created at the same time.

When processing this request, the following event will be executed by the HttpApplication class (pipeline Processing request) to enter the real topic. Haha, so much nonsense
1. Verify the request, check the information sent by the browser, and determine whether it contains potentially malicious tags.
2. If you have configured any URL in the UrlMappingSection of the Web. config file, perform URL ing.
3. the BeginRequest event is triggered. (In ASP. NET Response Request occurs as the first event in the HTTP ruling line pipeline (by the way. the events in the. net framework have not been reviewed for a long time. The public event EventHandler BeginRequest, the event uses the delegate, and the delegate is a method with the same return type and parameters, eventHandlder is a delegate method public delegate void EventHandler (Object sender, EventArgs e)
4. The AuthenticateRequest event is triggered. (This event occurs when the security module has a user ID)
5. Trigger the PostAuthenticateRequest event. (This event occurs when the security module has a user ID)
6. Trigger the AuthrizeRequest event (the AuthrizeRequest event sends a signal indicating that ASP. NET has authorized the current request.
7. Trigger the PostAuthorizeRequest event (this event sends a signal that ASP. NET has authorized the current request.
8. Trigger the ResolveRequestCache event (when ASP. NET completes the authorization event so that the cache module can provide services for the request from the cache, thus skipping the execution of the event handler.
9. Trigger the PostResolveRequestCache event (this occurs when ASP. NET skips the execution of the current event handler and allows the cache module to satisfy the request from the cache)
10. 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 the instance.
11. Trigger the PostMapRequestHandler event (this occurs when ASP. NET maps the current request to the corresponding event handler
12. An AcquireRequestState event is triggered when ASP. NET acquires the current off State (such as session state) associated with the current request.
13. Trigger the PostAcquireRequestState event
14. Trigger the PreRequestHandlerExecute event (occurs just before ASP. NET starts executing event processing)
15. Call the appropriate IHttpHandler class ProcessRequest method (or asynchronous BeginProcessRequest) for the request. For example, if the request is for a page, the current page instance will process the request
16. Trigger the PostRequestHandlerExecute event (which occurs when the ASP. NET event handler is executed)
17. Trigger the ReleaseRequestState event (after all request event handlers are executed in ASP. NET, this event will cause the status module to save the current status data)
18. Trigger the PostReleaseRequestState event (this occurs when ASP. NET has completed the execution of all request event handlers and the Request status data is stored)
19. If the Filter attribute is defined, the response is filtered.
20. Trigger the UpdateRequestCache event (when ASP. NET executes the event handler so that the cache module storage will be used to respond to the cache for subsequent requests)
21. Trigger the PostUpdateRequestCache event (when ASP. NET completes the cache module update and stores the following responses, these responses are used to meet subsequent requests from the cache)
22. An EndRequest is triggered (the last event in the HTTP execution pipeline chain occurs when ASP. NET responds to the request.

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.