If you are an MVC developer, then this entire flow should be in your DNA. This not only solves complex problems; rather, it also makes an app more robust, future proof, maintainable and testable. Below, I have pasted a high level diagram for the same. Therefore, without wasting time, let us get started.


The entry point for any MVC application begins with routing. After that the ASP.NET platform receives the request and figures out how it should be handled by URL routing modules. The routing module is responsible for matching incoming URLs. All routes are associated with route handlers. So, if the request matches the defined route, then the MVC route handler will create an instance of MVC HTTP handler and retrieve the requested controller. MVC RouteHandler and MVC HTTPHandler are two classes and together they act as a gateway into the MVC Framework.
Then, MVC handler begins the process of initializing and executing the controller. The MVC framework handles converting our route data into a concrete controller which can handle requests. This is accomplished via the controller factory and activators, which are responsible for creating a controller instance. This is also the place where features like Dependency injection can be injected.
After the controller is created, the next step is action execution. A component called action invoker finds and selects the appropriate action method to invoke on our controller. Before this step model binding takes place, which actually maps the data from HTTP request to parameters on our action methods. Action filters are also called before and after the method produces an action result.
After the controller is created, the next step is action execution. A component called action invoker finds and selects the appropriate action method to invoke on our controller. Before this step model binding takes place, which actually maps the data from HTTP request to parameters on our action methods. Action filters are also called before and after the method produces an action result.
Now, after Action Result takes place, the next step is result execution. MVC separates declaring the result from executing the result. So, if the result is view type then view engine will be called and it's responsible for finding and rendering our view. If the result is not view, then action result will execute on its own. This result execution actually generates an actual response to that original HTTP request. So, this was the high level stuff.
Now, let us jump in the demo section. I have created a simple MVC 5 app as in the following screenshot.

Now, let us jump in the demo section. I have created a simple MVC 5 app as in the following screenshot.

One important point to understand here, is that at the heart of any MVC application class sits MvcApplication; you can find the same in global.asax file.
- using System.Web.Mvc;
- using System.Web.Optimization;
- using System.Web.Routing;
- namespace MVC_LifeCycle_Demo
- {
- public class MvcApplication : System.Web.HttpApplication
- {
- protected void Application_Start()
- {
- AreaRegistration.RegisterAllAreas();
- FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
- RouteConfig.RegisterRoutes(RouteTable.Routes);
- BundleConfig.RegisterBundles(BundleTable.Bundles);
- }
- }
- }





Rajesh PathakotiPosted Nov 7, 2017, 8:29 PM
Excellent article, Now I understood the MVC life cycle exactly. Thanks a lot brother
Manav PandyaPosted Sep 19, 2016, 3:32 AM
Great share sir ...
SubashPosted Jul 25, 2016, 12:36 AM
Thanks onceagain
SubashPosted Jul 25, 2016, 12:35 AM
Being a Fresher in MVC it is very useful to me
Jaipal ReddyPosted Feb 8, 2016, 11:32 PM
Thank you for sharing sir. .
Amit Kumar SinghPosted Feb 6, 2016, 7:40 AM
Nice One
Vignesh ManiPosted Jan 27, 2016, 5:10 AM
Nice one
sreenivasa kPosted Jan 21, 2016, 3:49 PM
very nice
Jaco ZwartsPosted Jan 18, 2016, 12:44 AM
Thank you for this mvc life cycle series! This will help me alot!
Ehsan SajjadPosted Jan 11, 2016, 10:22 AM
Very Well Written
Manoj KallaPosted Jan 11, 2016, 10:01 AM
Good one
Ankit SaxenaPosted Jan 11, 2016, 8:07 AM
Nice
Raja TPosted Jan 10, 2016, 11:11 PM
Nice, Thanks for sharing
Humayun Kabir MamunPosted Jan 10, 2016, 10:27 PM
Thanks Rahul for sharing...
Ankur MistryPosted Jan 10, 2016, 12:59 PM
Nice thanks for sharing