Asp. The sequence of events executed in the ProcessRequest method in HttpApplication. NET WebForm and MVC overall request flowchart

Source: Internet
Author: User

Asp. The sequence of events executed in the ProcessRequest method in HttpApplication. Net

1.BeginRequest Start processing Requests

2.AuthenticateRequest Authorization authentication request, obtaining user authorization information
3.PostAuthenticateRequest Get success
4.AunthorizeRequest authorization, general to check whether the user is granted permission
5.PostAuthorizeRequest Get Authorization
6.ResolveRequestCache Gets the page cache result (if none is executed)
7.PostResolveRequestCache Cache has been obtained
8.PostMapRequestHandler Creating a Page object
9.AcquireRequestState get session--first to determine whether the current Page object implements the IRequiresSessionState interface, if implemented, from the browser sent from the request packet header to obtain SessionID, and to the server's In the session pool, the corresponding session object is obtained, and the last assignment is given to the session property of HttpContext.
10.PostAcquireRequestState Get session
11.PreRequestHandlerExecute prepare the Page object for execution
X executes the ProcessRequest method (1.ashx,1.aspx) of the Page object and, if the request is 1.aspx, runs the page life cycle
12.PostRequestHandlerExecute finished executing the Page object
13.ReleaseRequestState Release Request Status
14.PostReleaseRequestState released request status
15.UpdateReuqestCache Update Cache
16.PostUpdateRequestCache Cache has been updated
17.LogRequest Log Records
18.PostLogRequest completed Log

19.EndRequest Complete


You can run the test again in Global.asax with Application_ as the prefix + event name! For example:

 public class MvcApplication:System.Web.HttpApplication {protected void Application_Start () {            Arearegistration.registerallareas ();            Webapiconfig.register (globalconfiguration.configuration);            Filterconfig.registerglobalfilters (globalfilters.filters);            Routeconfig.registerroutes (routetable.routes);          Bundleconfig.registerbundles (Bundletable.bundles); } public void Application_BeginRequest (object sender, EventArgs e) {HttpApplication obj = se            NDEr as HttpApplication; Obj.        Context.Response.Write ("1 application_beginrequest<br/>");  } public void Application_resolverequestcache (object sender, EventArgs e) {HttpApplication obj =            sender as HttpApplication; Obj.        Context.Response.Write ("6 application_resolverequestcache<br/>");        public void Application_postresolverequestcache (object sender, EventArgs e){HttpApplication obj = sender as HttpApplication; Obj.        Context.Response.Write ("7 application_postresolverequestcache<br/>"); } public void Application_prerequesthandlerexecute (object sender, EventArgs e) {HttpApplication            obj = sender as HttpApplication; Obj.        Context.Response.Write ("one application_prerequesthandlerexecute<br/>"); }    }}


The following is a flowchart of the MVC overall request, from the Intelligence podcast Black Horse Training Course


ASP. NET WebForm Overall request flow chart, from Intelligence podcast Black Horse Training Course



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.