Request process
1. The client sends the request to the server side.
2. First by the server-side HTTP. SYS kernel module is accepted and distributed to IIS(or other Web server software) based on the port.
3.IIS (composed of a software process, a W3SVC service) receives a request and is distributed to the specified worker process based on the port
4. The worker process checks the file extension of the requested file for processing by the corresponding extender. ( such as. aspx,. ascx,. ashx, and. asmx are given to the Aspnet_isapi.dll extender)
5. When the request is. aspx, the Extender is handed to the Aspnetruntime managed environment to call the isapiruntime.processrequest (IntPtr ECB) method (the ECB is the handle of the request. The handle is the identity of the operating system on a resource).
The 6.ISAPIRuntime PR method encapsulates the request into a httpworkrequest object and then calls the HttpRuntime. PR method.
7. In HttpRuntime's PR method, the Httpworkrequest object is encapsulated as a HttpContext object. Then a HttpApplication object is produced by HttpApplicationFactory .
The 8.HttpApplication object will take the HttpContext object and go through the pipeline processing request.
9. In a pipeline request, the Ihttphandle object A is instantiated according to the request by default in the 7th and 8 events. 11th, in the 12 event, A's PR method is called.
10. If a is a generic handler, call the PR method directly. In the case of an ASPX program, the page life cycle process is gone.
Page life cycle
1.Create Instance Create all controls
2.IsPostBack determines whether the page is processed for the first time
3.Init all controls have been initialized and all appearance settings have been applied to raise
3.ViewState loading ViewState Setting control values
4.Load execution of all Load events
5.ChangeEvent events that perform control changes
6.Complete Events
7.PreRender pre-rendered page, last chance to change page
8.SaveState Save Status on page
9.Render Rendering Page
10.Unload Uninstall
Pipeline Events
Validation of the request checks the information sent by the browser and determines whether it contains potentially malicious tokens. For more information, see validaterequest and scripting Intrusion Overview.
If any URLs have been configured in the Urlmappingssection section of the Web. config file , the URL mapping is performed.
Raises the beginrequest event.
Raises the AuthenticateRequest event.
Raises the Postauthenticaterequest event.
Raises the AuthorizeRequest event.
Raises the Postauthorizerequest event.
Raises the Resolverequestcache event.
Raises the Postresolverequestcache event.
-
ihttphandler to process the request. > based on the file name extension of the requested resource (mapped in the application's configuration file), select implement ihttphandler class to process the request. page class and the page needs to be compiled, ASP. Compiles the page before creating an instance of it. " If the request is for an object (page) derived from the page class, and the page needs to be compiled, ASP. NET compiles it before it creates an instance of the page.
Raises the Postmaprequesthandler event.
Raises the AcquireRequestState event.
Raises the Postacquirerequeststate event.
-
prerequesthandlerexecute event. " > prerequesthandlerexecute event.
-
processrequest Method (or the asynchronous version ihttpasynchandler. BeginProcessRequest) of the appropriate ihttphandler class for the request. " To invoke the appropriate for the request, the ihttphandler class processrequest Method (or asynchronous version ihttpasynchandler . BeginProcessRequest). For example, if the request is for a page, the current page instance will process the request.
Raises the PostRequestHandlerExecute event.
Raises the ReleaseRequestState event.
Raises the Postreleaserequeststate event.
If the Filter property is defined, the response filter is executed.
Raises the Updaterequestcache event.
Raises the Postupdaterequestcache event.
Raises the EndRequest event.
Raises the Presendrequestheaders event.
Raises the Presendrequestcontent event.
ASP. NET Request Processing complete process