MVC vs Web Forms

MVC vs Web Forms

In this blog, we will look into benefits of ASP.NET MVC followed by MVC vs Web Forms features. ASP.NET MVC is supplemental technology for ASP.NET Web Forms. Just using MVC for the project development will not improve the team productivity. It depends on type of project being developed, team skills etc.

Image-1.jpg

Request Flow

Image-2.jpg
                                      
ASP.NET MVC is based on Model-View-Controller architecture and having clear separation between presentation & control logic.

It provides better control over the HTML rendered to the browser. It is having built-in support for TDD [Test Driven Development]. We can create Test project with an option of choosing the Testing framework like Nunit, Visual Studio Unit Test.

We cannot use server-side controls, viewstate in it.

Coding in MVC is similar to doing in Classic ASP. So, it's easy for ASP or JSP developers to adapt to the coding standards of MVC.

MVC is having support for multiple view engines like Razor, Spark. View Engine is a component that executes Server side code like database operations, generating HTML.

URLs generated in MVC are user-friendly and Search Engine optimized.

MVC suits better for projects based on TDD and having frequently changing requirements.

So, choosing MVC for your project development depends on project type, developer's skill set and type of requirements.

Below is the comparsion of MVC, Web Forms features:


ASP.NET MVC WebForms
Based on Model-View-Controller model
Provides clear separation between presentation & control logic
Built-in support for TDD
Better control over rendered HTML & js
SEO & User friendly URLs using routine engine
Suits for Classic ASP, JSP developers
Suits for applications having dynamic requirements
Support for multiple view engines like Razor, Spark
No ASP.NET Page lifecycle & page level events like page_init, page_load
Based on Postback model
Uses server-side controls & ViewState
Suits for RAD [Rapid Application Development]
Built-in support for cross-browser rendering capabilities
Less control over rendered HTML

We can mix Web Forms & MVC in a single project. By this way, we can make use of MVC for new development/ enhancements by maintaining existing code base on Web Forms.

Ebook Download
View all
Learn
View all