In this Blog, we are going to talk about Overview of ASP.NET MVC, what ASP.NET MVC is, its advantages, filters and Lifecycle.
So, let’s get started.
Let us first try to understand What is ASP.Net MVC?
The ASP.NET MVC is a lightweight frameworkdeveloped by Microsoft. It is integrated with existing ASP.NET features such as membership-based and authentication master pages. The MVC is defined in System.Web.Mvc assembly. We can build web apps using the model view controller pattern. The MVC architectural pattern has existed for a long time in software engineering. All most all the languages use MVC with slight variation, but conceptually it remains the same.
Now, let’s talk about ASP.NET MVC framework in brief.
In this section, we will talk about the Model, View and Controller in ASP.NET MVC Framework.
Model represents domain specific data and business logic in MVC architecture. It maintains the data of the application. Model objects retrieve and store model state like a database.
View is a user interface which displays data from the model to the user and also enables them to modify the data.
The Controller in MVC architecture handles any incoming URL request. Controller is a class, derived from the base class System.Web.Mvc.Controller.
Now we will discuss advantages of ASP.NET MVC
ASP.Net MVC enables the full control over the rendered HTML.
It provides clean separation of concerns and enables Test Driven Development.
It follows the design of stateless nature of the web. RESTful urls enables SEO and
No ViewState and PostBack events.
Let’s discuss few points on asp.net architecture
ASP.NET works on three tier architecture. This architecture is extremely popular because they increase application performance, scalability, flexibility, and code reuse. In three tier architecture, applications are divided into three major areas of functionality.
The presentation Layer
Presentation layer provides the interface to the users of website or application.
The business Layer
Business layer or Application layer acts between Application layer and Data Access Layer. This layer contains our logic, validating the data and other functions.
The data Layer
All the code related to database is written in this layer. It contains methods to connect with database.
Let us now analyze the various ASP.NET MVC Filters
Starting with, authorization filters which Performs authentication and authorizes before executing action method.
While action filters, performs operation before and after an action method executes.
Result filters, performs some operation before or after the execution of view result.
And exception filters, performs some operation if there is an unhandled exception thrown during the execution of the ASP.NET MVC pipeline.
Finally, Let us understand ASP.NET MVC Lifecycle.
MVC has two life cycles called the application life cycle and the request 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.
While the request life cycle is the sequence of events that happen every time an HTTP request is handled by our application.