What Is ASP.NET MVC?
The Microsoft ASP.NET MVC framework is Microsoft’s newest framework for building web applications. The ASP.NET MVC framework was created to support pattern-based software development. In other words, the framework was designed to make it easier to implement software design principles and patterns when building web applications.
Furthermore, the ASP.NET MVC framework was designed to its core to support unit tests. Web applications written with the ASP.NET MVC framework are highly testable.
Because ASP.NET MVC applications are highly testable, this makes the ASP.NET MVC framework a great framework to use when practicing test-driven development.
The Architecture of an ASP.NET MVC Application
An MVC application, a Model View Controller application, is divided into the following three parts:
- Model-An MVC model contains all of an application’s logic that is not contained in a view or controller. The model includes all of an application’s validation logic, business logic, and data access logic. The MVC model contains model classes that model objects in the application’s domain.
- View-An MVC view contains HTML markup and view logic.
- Controller-An MVC controller contains control-flow logic. An MVC controller interacts with MVC models nd views to control the flow of application execution.
Difference between Asp.Net MVC and Web Forms
|ASP.NET Web Forms||ASP.NET MVC|
|Asp.Net Web Form follow a traditional event driven development model||Asp.Net MVC is a lightweight and follow MVC (Model, View, Controller) pattern based development model.|
|Asp.Net Web Form has server controls.||Asp.Net MVC has html helpers.|
|Asp.Net Web Form supports view state for state management at client side.||Asp.Net MVC does not support view state.|
|Asp.Net Web Form has file-based URLs means file name exist in the URLs must have its physically existence.Asp.Net Web Form follows Web Forms Syntax|
|Asp.Net MVC has route-based URLs means URLs are divided into controllers and actions and moreover it is based on controller not on physical file.Asp.Net MVC follow customizable syntax (Razor as default)|
|In Asp.Net Web Form, Web Forms(ASPX) i.e. views are tightly coupled to Code behind(ASPX.CS) i.e. logic.||In Asp.Net MVC, Views and logic are kept separately.|
|Asp.Net Web Form has Master Pages for consistent look and feels.||Asp.Net MVC has Layouts for consistent look and feels.|
|Asp.Net Web Form has User Controls for code re-usability.||Asp.Net MVC has Partial Views for code re-usability.|
|Asp.Net Web Form has built-in data controls and best for rapid development with powerful data access.||Asp.Net MVC is lightweight, provide full control over markup and support many features that allow fast & agile development. Hence it is best for developing interactive web application with latest web standards.|
|Asp.Net Web Form is not Open Source.||Asp.Net Web MVC is an Open Source.|