ASP.Net MVC Life cycle

Posted by : Rakesh Sinha
Posted On : 10/1/2015 12:11:47 PM
Posted As :Question Answers
Category :Software Development
View : 677
                 MVC application life cycle has two main phases
1. Creating the request object 
2. Sending response to the browser

Creating Response object -

The request object creation has four major steps as below.

Fill route - MVC requests are mapped to route tables in which we can specify which controller and action to be invoked. If the request came as first request the first step is to fill the route table with routes collection. Filling of route table happens in the global.asax file.

Fetch route - Depending on the URL sent by client "UrlRoutingModule" searches the route table to create "RouteData" object which has the information of which controller and action to be invoked.
 
Request context created - The "RouteData" object is used to create the "RequestContext" object.

Controller instance created - This request object is sent to "MvcHandler" instance for creating controller class instance. Once the controller class object is created it calls the "Execute" method of the controller class.

Creating Response object :
This phase involved two steps executing the action and finally sending the response as a result to the view.

Execute Action  - The "ControllerActionInvoker" determines which action to executed and executes the action.

Result sent - The action method executes and creates the type of result which can be a view result , JSON result, file result  etc.
 
when a Project really is Agile
Submitted in: Ask Question | Category: Project Management
what is Data Binding?
Submitted in: Ask Question | Category: Software Development
how to pass data from one activity to another activity?
Submitted in: Ask Question | Category: Software Development
What is Data Annotations ?
Submitted in: Ask Question | Category: Software Development
What is difference between $Scope and $rootScope ?
Submitted in: Ask Question | Category: Software Development
What is difference between TextBox and TextBoxFor?
Submitted in: Ask Question | Category: Software Development
how to send selected data to another page on button click
Submitted in: Ask Question | Category: Software Development
what is attribute routing in asp.net mvc
Submitted in: Ask Question | Category: Software Development
What’s an Object ?
Submitted in: Ask Question | Category: Software Development
What is the Android Architecture?
Submitted in: Ask Question | Category: Software Development
What is difference between account payable and bills payable?
Submitted in: Ask Question | Category: Accounting
What is the diff. between abstract class & interface
Submitted in: Ask Question | Category: Software Developement

All rights reserved to Interviewfunda.com. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. While using this site, you agree to have read and accepted our terms of use and privacy policy. Best viewed at 1024 x 768 resolution with Internet Explorer 5.0 or Mozila Firefox 3.5 or Google Crome and higher