Reference: ASP.NET MVC and Web forms
When working with Sitefinity CMS, you can choose which technology to work with - ASP.NET MVC or Web Forms. The recommended approach for straightforward development and improved productivity is to work with ASP.NET MVC framework to build websites and interfaces, widgets, interactions, and applications. For more information about the benefits when working with MVC technology, see For developers: Develop with Sitefinity CMS and ASP.NET MVC.
Following is a comparison between the two frameworks that can help you when choosing one or the other when deciding which approach suits your web application requirements
|Architecture of your web application
Three-layered architecture that ensures separation of concerns.
MVC architecture pattern complements the SOLID principles.
|Have flexibility over architecture.
|Stateless web or stateful model
||MVC fully embraces HTTP.
||ASP.NET WebForms provides an abstraction over the HTTP protocol to make development closer to traditional desktop development and managing state information easier.
||Controllers in MVC are decoupled from any state and can be easily tested and mocked. Thus, automatic unit testing is easily supported.
||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.
|Control over markup
||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.
||WebForms model uses HTTP and HTML concepts to emulate state. This clutters the markup of a page.
||Rich routing capabilities.
||URLs direct to ASPX pages.
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.
||Controllers are a separate component, so can be easily reused between views.
||The behind code is tightly coupled with view. It is not reusable.
||Since ViewState is not supported, page sizes are smaller and performance is optimized.
||Stateful support means the ViewState is stored in the page itself, resulting in increased page size.
|Parallel application development
||Thanks to the loosely coupled components, parallel development is possible for different components.
||Pages are tightly coupled with the code behind, which make parallel development almost impossible.
||Yes, along with code behind, postback mechanism, and ViewState.
|Developers’ learning effort
You can work with any of the two technologies, or use both of them, depending on your development needs and requirements. Developers with an MVC background can implement custom controllers and views that can be also used in a Sitefinity CMS project. With Sitefinity CMS, you can combine both MVC and WebForms widgets and use them on the same page. You can create new functionality using MVC, whilst not breaking anything that you are currently working with.
For more information about MVC development, see For developers: Develop with Sitefinity CMS and ASP.NET MVC.