Understanding ASP.NET MVC Application Life Cycle
Introduction :
A developer must understand the life cycle of ASP.NET MVC so that he gain a full control over the developer platform. For example, the ASP.NET webforms platform features a complex page life cycle. Other .NET platforms, like Windows phone apps, have their own application life cycles.If you are new to ASP.NET MVC ,I recommend you to read ASP.NET MVC Basics
What is ASP.NET MVC
The Model-view-controller (MVC) is an architectural pattern framework developed by Microsoft which is an alternative to asp.net web forms for creating web application. The MVC framework is defined in the System.Web.Mvc asembly.
Trending Now : ASP.NET MVC 5 NEW Features
However, a tool or framework is only as good as its usage. The components of MVC don’t prevent a programmer from keying garbage code into them, or duplicating the same code across all three components. There are therefore some guidelines you should follow when implementing ASP.NET applications in the MVC framework.
ASP.NET MVC Life Cycle
One thing that is true for all these platforms regardless of the technology is that understanding the processing pipeline can help you better leverage the features available and MVC is no different.
- MVC has two life cycles
- The application life cycle
The Application Life Cycle
The application life cycle refers to the time at which the application process actually begins running IIS until the time it stops. This is marked by the application start and end events in the startup file of your application.
The MvcHandler is responsible for initiating the real processing inside ASP.NET MVC. MVC handler implements IHttpHandler interface and further process the request by using ProcessRequest method.
The ASP.NET MVC framework supports four different types of filters:
1. Authorization filters — Implements the IAuthorizationFilter attribute.
2. Action filters — Implements the IActionFilter attribute.
3. Result filters — Implements the IResultFilter attribute.
4. Exception filters — Implements the IExceptionFilter attribute.
Must Read : Difference Between ASP.NET Webform and ASP.NET MVC
The request life cycle
It is the sequence of events that happen every time an HTTP request is handled by our application.The entry point for every MVC application begins with routing.Modules are .NET components that can hook into the application life cycle and add functionality. The routing module is responsible for matching the incoming URL to routes that we define in our application.
All routes have an associated route handler with them and this is the entry point to the MVC framework.
ASP.NET MVC TOPICS LATEST UPDATE — FREE PDF DOWNLOAD LINK