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

  MVC  Web forms
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. 
Test-driven development  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. 
URL routing  Rich routing capabilities.   URLs direct to ASPX pages.  
Extensibility

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. 

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.
Reusability  Controllers are a separate component, so can be easily reused between views.  The behind code is tightly coupled with view. It is not reusable. 
Performance  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. 
Event-driven development  Not supported. Yes, along with code behind, postback mechanism, and ViewState
Developers’ learning effort  Prior experience in web development and JavaScript is a plus.  Do not need much HTML and JavaScript knowledge. 

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.


Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.

Web Security for Sitefinity Administrators

The free standalone Web Security lesson teaches administrators how to protect your websites and Sitefinity instance from external threats. Learn to configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.

Foundations of Sitefinity ASP.NET Core Development

The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.

Was this article helpful?