Steps Involved in MVC Request Life Cycle (or) ASP.NET MVC PipeLine

Venkatesh Gunda
2 min readNov 10, 2018

--

ASP.NET MVC Pipeline

Routing:

URL Routing Module: The request is handed over to the Routing Module by IIS (Internet Information Server) which analyses the request looks up for the Routing Table to figure out the controller it maps to and also action mapping. Routing Table is a Static Container of Routes defined in ASP.NET applications of corresponding controllers and actions mapping.

MVC Route Handler: If the route is found in the Routing table, this route handler is executed and an instance of MVC HttpHandler is given as an output.

MVC Http Handler: Http Handler has the controller and action mapping information. It triggers the specified action in the given controller. It also passes any query string present in the URL to the Controller/Action.

Together, MVC Route Handler and MVC Http Handler act as the gateway of MVC Framework. MVC Handler begins the initialization and execution of the controller. MVC Http Handler converts the route data and converts them into a concrete controller. It is capable of serving the request.

Controller Initialization:

MVC Handlers are able to perform this responsibility with the help of ASP.NET MVC Controller Factory. Activators are responsible for creating an instance of the controller. This is also the location where dependency injection is performed if the application has been designed to invoke parameterized constructor/controller to resolve dependencies.

Action Execution:

After the controller instance is created, the next task is to find and execute the corresponding action. Action Invoker finds and executes the action defined in the routing table. Before the action method is called, Model Binder binds the Http Request data with the Action Method. Action Filters are executed two times before the action is executed (during execution) and after the action is executed (after execution).

Result Execution:

Once the Action Execution is completed, the next step is Result Execution. MVC separates action execution from result execution. Depending on the type of result Action Execution provides, the result execution operates accordingly. If the result is View/Page, ASP.NET renders an HTML View as the response of HTTP Request. If the result is not View, then it is passed as Http Response like JSON, XML etc

Source: https://www.youtube.com/watch?v=KwEIP91-hHQ

--

--