What is ASP.NET MVC?
ASP.NET MVC is a framework for developing web applications that follow Model-View-Controller Pattern.
It is built on top of the ASP.NET framework with an aim to enhance existing functionality. As a result, you can use features of ASP.NET while working on ASP.NET MVC applications.
Advantage of ASP.NET MVC
- Enables the full control over the rendered HTML and its control.
- Provides clean separation of concerns(SoC).
- Enables Test Driven Development (TDD).
- Following the design of stateless nature of the web.
- No ViewState and PostBack events
All the main 3 parts of asp.net mvc are explained in below section.
Model is responsible for all the actual data processing related tasks, like database connection, querying the database.It provides data to the view without concern about the actual formatting and look and feel.
Data provided by Model is Independent of UI so it can also be reuse with as many other views without code redundancy. As a result, this makes maintenance easy and reduces bugs and allows code reuse at good extent.
Controllers are basically the central unit for your ASP.NET MVC web application. It interacts with incoming HTTP web Request.So, the controller determines which model will be selected, and then it takes the data from the model and process it and passes the same to the respective view after that view is rendered with correct UI. Actually, controllers act as a bridge which accepts the input and renders the proper output.
Controllers are C# classes which inherit from System.Web.MVC.Controller, it is the built-in controller base class of.Net framework.Each public method of the controller is known as an action method.
The View is the part of the application that handles the display of the data. it consists all required HTML tags.