For developers: ASP.NET MVC or Web forms
When it comes to choosing which framework to work with, you need to think about several key points that differentiate conceptually MVC and WebForms models.
Following is a comparison between the two frameworks that can help you when choosing one or the other when deciding which model suits your web application requirements
|
Web forms |
MVC |
Architecture of your web application |
Have full flexibility over architecture. |
Three-layered architecture that ensures separation of concerns. |
Stateless web or stateful model |
ASP.NET WebForms provides an abstraction over the HTTP protocol to make development closer to traditional desktop development and managing state information easier. |
MVC fully embraces HTTP.
|
Test-driven development |
WebForms relies on controls to be the building blocks for user interface. Because of the stateful nature of WebForms and the fact that controls do not work without an HTTP context, they are hard to test. |
Controllers in MVC are decoupled from any state and can be easily tested and mocked. Thus, automatic unit testing is easily supported.
|
Control over markup |
WebForms model uses HTTP and HTML concepts to emulate state. This clatters the markup of a page. |
MVC allows you to directly have control over the whole markup. The Razor rendering engine, the developer completely controls the markup as the abstractions provided by the Control class are gone. |
URL routing |
URLs direct to ASPX pages. |
Rich routing capabilities.
|
Extensibility |
You can use master pages, pages, and controls with hooks and helper classes to extend the default functionality. You can also inject JavaScript and generate HTML and CSS.
|
MVC supports a number of view engines, such as Razor. In addition, you can implement your own view engine.
You can also use container models, such as Dependency Injection and Inversion of Control.
You can extend the routes, controllers, filters, and actions in MVC and also to define your own HTML Helpers.
|
Reusability |
The behind code is tightly coupled with view. It is not reusable. |
Controllers are a separate component, so can be easily reused between views. |
Performance |
Stateful support means the ViewState is stored in the page itself, resulting in increased page size. |
Since ViewState is not supported, page sizes are smaller and performance is better. |
Parallel application development |
Pages are tightly coupled with the code behind, which make parallel development almost impossible. |
Thanks to the loosely coupled components, parallel development is possible for different components. |
Event-driven development |
Yes, along with code behind, postback mechanism, and ViewState. |
Not supported. |
Developers’ learning effort |
Do not need much HTML and JavaScript knowledge. |
More difficult to learn because of the absence of event-driven development. Prior experience in web development and JavaScript is a plus. |
The important point to note is that one framework does not replace the other, but they serve different purposes and requirements. For example, an advantage of ASP.NET WebForms is the vast infrastructure and ecosystem built around it. On the other hand, working with ASP.NET MVC makes a lot of sense for web pages.