ASP.NET MVC Basics
January, 2019 / by Krishan Dutt Sharma
ASP.NET MVC stands for ASP.NET Model View Controller design pattern. MVC was first invented by Trygve Reenskaug and was named as “Thing Model View Editor” pattern originally. Slowly it became popular and renamed as “Model View Controller”.
ASP.NET MVC was created by Scott Guthrie of Microsoft in 2007 based on the MVC framework implemented in different framework like Ruby on Rails, Spring etc. ASP.NET MVC (Model View Controller) is an architectural design pattern that separates an application into three main components
ASP.NET MVC is not the replacement of traditional ASP.NET Web form but it’s an alternative. The ASP.NET MVC App is highly testable application than traditional ASP.NET Web form applications. The namespace used for ASP.NET MVC is System.Web.Mvc.
Let’s understand the MVC architecture in ASP.NET.
MVC stands for Model, View and Controller. MVC separates application into three components – Model, View and Controller.
Model: Model represents shape of the data and business logic. It maintains the data of the application. Model objects retrieve and store model state in a database.
“Model is a data and business logic.”
View: View is a user interface. View display data using model to the user and also enables them to modify the data.
“View is a User Interface.”
Controller: Controller handles the user request. Typically, user interact with View, which in-tern raises appropriate URL request, this request will be handled by a controller. The controller renders the appropriate view with the model data as a response.
“Controller is a request handler.”
The View is only responsible to display the information. Controller is responsible for receiving request, processing it using Model and sending it back to View and Model is responsible to apply logic, connect to the database and retrieve data.
- MVC stands for Model, View and Controller.
- Model is responsible for maintaining application data and business logic.
- View is a user interface of the application, which displays the data.
- Controller handles user’s requests and renders appropriate View with Model data.