web application has two main execution steps, first understanding the request and depending on the type of the request sending out appropriate response. MVC application life cycle is not different it has two main phases, first creating the request object and second sending our response to the browser.
Creating the request object:
The request object creation has four major steps. The following is the detailed explanation of the same.
1: Fill route
MVC requests are mapped to route tables which in turn specify which controller and action to be invoked. So if the request is the first request the first thing is to fill the route table with routes collection. This filling of route table happens in the global.asax file.
2: Fetch route
Depending on the URL sent “UrlRoutingModule” searches the route table to create “RouteData” object which has the details of which controller and action to invoke.
3: Request context created
The “RouteData” object is used to create the “RequestContext” object.
4: Controller instance created
This request object is sent to “MvcHandler” instance to create the controller class instance. Once the controller class object is created it calls the “Execute” method of the controller class.
Creating Response object
This phase has two steps executing the action and finally sending the response as a result to the view.
Liked By
Write Answer
Explain the process of MVC application life cycle?
Join MindStick Community
You have need login or register for voting of answers or question.
Manish Kumar
13-Jun-2017web application has two main execution steps, first understanding the request and depending on the type of the request sending out appropriate response. MVC application life cycle is not different it has two main phases, first creating the request object and second sending our response to the browser.
Creating the request object:
The request object creation has four major steps. The following is the detailed explanation of the same.
1: Fill route
MVC requests are mapped to route tables which in turn specify which controller and action to be invoked. So if the request is the first request the first thing is to fill the route table with routes collection. This filling of route table happens in the global.asax file.
2: Fetch route
Depending on the URL sent “UrlRoutingModule” searches the route table to create “RouteData” object which has the details of which controller and action to invoke.
3: Request context created
The “RouteData” object is used to create the “RequestContext” object.
4: Controller instance created
This request object is sent to “MvcHandler” instance to create the controller class instance. Once the controller class object is created it calls the “Execute” method of the controller class.
Creating Response object
This phase has two steps executing the action and finally sending the response as a result to the view.