.Net Interview Questions and Answers

Search:

Explain MVC application life cycle?

By : Shiv Prasad Koirala | Mar 18th, 2014 | Views : 7673 | Comments : 0 Bookmark and Share

Download MVC interview question book from http://www.codeproject.com/Articles/556995/MVC-interview-questions-with-answers


Note: - There  is nothing as such called as MVC life cycle. I think lot of people are obsessed with ASP.NET page life cycle and they think there is life cycle in MVC as well. To be specific the MVC request goes through various steps of execution and that's what is  termed as MVC application life cycle.



Any 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 Response object: -
The request object creation has four major steps. Below is the detail explanation of the same.


Step 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.


Step 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.

 

Step 3 Request context created: - The "RouteData" object is used to create the "RequestContext" object.


Step 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.


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


Step 6 Result sent: - The action method executes and creates the type of result which can be a view result , file result , JSON result etc.


So in all there are six broad steps which get executed in MVC application life cycle.


Note :- In case you are not able to remember the above steps during interview remember the acronym FFRCER(Fight For Respect Can Evoke Revolution).


If you are fresher in MVC start learning MVC (model view controller) step by step from the following videos.


 
Rate this Article :
1 Star
2 Stars
3 Stars
4 Stars
5 Stars
1 1 1 2 1
 
 
 
 

.NET interview questions 6th edition (Sixth edition) - By Shivprasad Koirala

In this article we will explain .NET interview questions 6th edition (Sixth edition) - By Shivprasad Koirala.... Read More

WCF Interview questions and answers: -What is the difference between WCF fault exceptions and normal .NET exceptions?

In this article we will show difference between WCF fault exceptions and normal .NET exceptions. For more articles and videos visit us on http://www.questpond.com/... Read More

WCF interview questions and answers: - What is the difference between Service endpoint and Client endpoint?

In this article we will explain What is the difference between Service endpoint and Client endpoint.... Read More

C# and .NET interview question: - Define Named and Optional Arguments?

Visual C# 2010 introduces two interesting features called as Named and Optional Arguments.... Read More

MVC vs ASP.NET ( MVC Interview question with answers )?

In this article we will explain MVC vs ASP.NET.For more articles and videos visit us on www.questpond.com... Read More

.NET interview questions 6th edition (Sixth edition) - By Shivprasad Koirala

In this article we will explain .NET interview questions 6th edition (Sixth edition) - By Shivprasad Koirala.... Read More

WCF Interview questions and answers: -What is the difference between WCF fault exceptions and normal .NET exceptions?

In this article we will show difference between WCF fault exceptions and normal .NET exceptions. For more articles and videos visit us on http://www.questpond.com/... Read More

WCF interview questions and answers: - What is the difference between Service endpoint and Client endpoint?

In this article we will explain What is the difference between Service endpoint and Client endpoint.... Read More

C# and .NET interview question: - Define Named and Optional Arguments?

Visual C# 2010 introduces two interesting features called as Named and Optional Arguments.... Read More

MVC vs ASP.NET ( MVC Interview question with answers )?

In this article we will explain MVC vs ASP.NET.For more articles and videos visit us on www.questpond.com... Read More

Article Categories

Learn in Hindi