ASP. net mvc request process
I. Application startup
1. Application_Start method, program startup
2. Use the RegisterRoutes method to register a route
3. The System. Web. Mvc. RouteCollectionExtensions. MapRoute method shows the MvcRoutehandler object.
Ii. Request to enter
You can find "" in "$ \ Windows \ Microsoft. NET \ Framework \ version \ Config \ Web. config ""
The request passes through the System. Web. Routing. UrlRoutingModule. Init method.
1. System. Web. Routing. UrlRoutingModule. Init Method
2. System. Web. Routing. UrlRoutingModule. PostResolveRequestCache Method
3. System. Web. Routing. RouteCollection. GetRouteData Method
4. System. Web. Routing. Route. GetRouteDara Method
Here this. RouteHandler is an instantiated MvcRouteHandler object in the first part. Now we have obtained the MvcRouteHandler instance. continue to the next step and return Step 1:
2. System. Web. Routing. UrlRoutingModule. PostResolveRequestCache Method
3. The System. Web. Mvc. MvcRouteHandler. GetHttpHandler method returns the MvcHandler object.
4. System. Web. Mvc. MvcHandler Construction Method
If this class implements the IHttpHandler interface, you have to check the ProcessRequest method.
5. System. Web. Mvc. MvcHandler. ProcessRequest Method
6. System. Web. Mvc. MvcHandler. ProcessRequestInit Method
Return to Step 1
5. System. Web. Mvc. MvcHandler. ProcessRequest Method
6. System. Web. Mvc. ControllerBase. Excete Method
7. System. Web. Mvc. Controller. ExcuteCore Method
8. System. Web. Mvc. Controller. ActionInvoker attributes
9. System. Web. Mvc. Controller. CreateActionInvoker Method
Return the instance that implements the IActionInvoker interface, and return step 1.
7. System. Web. Mvc. Controller. ExcuteCore Method
8. System. Web. Mvc. ControllerActionInvoker. InvokeAction Method
9. System. Web. Mvc. ControllerActionInvoker. InvokeActionResult Method
10. The System. Web. Mvc. ActionResult class encapsulates the results of an operation method.
Let's take a look at the override of the derived class of the ExcuteResult ActionResult:
Choose the ExcuteResult method in the ViewResultBase class.
11. System. Web. Mvc. ViewResultBase. ExcuteResult Method
12. System. Web. Mvc. ViewResult. ExcuteResult Method
13. System. Web. Mvc. ViewEngineCollection. FindView Method
14. System. Web. Mvc. VirtualPathProviderViewEngine. FindView Method
Return to step 2
13. System. Web. Mvc. ViewEngineCollection. FindView Method
14. System. Web. Mvc. ViewEngineCollection. Find Method
15. System. Web. Mvc. ViewEngineCollection. Find Method
So far, we have obtained the ViewEngineResult object. ViewEngineResult indicates the result of locating the view engine.
Now let's go back to Step 1 and continue.
11. System. Web. Mvc. ViewResultBase. ExcuteResult Method
12. System. Web. Mvc. BuildManagerCompiledView. Render Method
13. The System. Web. Mvc. RazorView. RenderView method is used to display the page using the Razor view engine.