Click here to Skip to main content
15,941,444 members
Articles / Web Development / ASP.NET
Technical Blog

Difference betweeen ASP.NET WebForms and ASP.NET MVC

Rate me:
Please Sign up or sign in to vote.
4.95/5 (27 votes)
14 Oct 2013CPOL3 min read 167.2K   36   8
Difference between ASP.NET Webforms and ASP.NET MVC

If you are visiting ASP.NET forums and communities, you will find the following questions frequently, i.e.

  • What is the difference between ASP.NET MVC and ASP.NET WebForms?
  • Is ASP.NET MVC going to replace ASP.NET WebForms?

In this web development tutorial, I'll try to answer and explain such queries.

First of all, let me clear that ASP.NET MVC is not replacing ASP.NET WebForms. Both these development models exist and can be used to develop ASP.NET applications. Both have pros and cons that we will discuss and compare here.

ASP.NET Web Forms use Page controller pattern approach for rendering layout. In this approach, every page has its own controller, i.e., code-behind file that processes the request. ASP.NET MVC uses Front Controller approach. That approach means a common controller for all pages processes the requests.
No separation of concerns. As we discussed that every page (.aspx) has its own controller (code behind i.e. aspx.cs/.vb file), so both are tightly coupled. Very clean separation of concerns. View and Controller are neatly separate.
Because of this coupled behavior, automated testing is really difficult. Testability is a key feature in ASP.NET MVC. Test driven development is quite simple using this approach.
In order to achieve stateful behavior, viewstate is used. Purpose was to give developers the same experience of a typical WinForms application. ASP.NET MVC approach is stateless as that of the web. So there is no concept of viewstate.
Statefulness has a lots of problem for web environment in case of excessively large viewstate. Large viewstate means increase in page size. As controller and view are not dependent and also no viewstate concept in ASP.NET MVC, so output is very clean.
ASP.NET WebForms model follows a Page Life cycle. No Page Life cycle like WebForms. Request cycle is simple in ASP.NET MVC model.
Along with statefulness, Microsoft tries to introduce server-side controls as in Windows applications. Purpose was to provide somehow an abstraction to the details of HTML. In ASP.NET Web Forms, minimal knowledge of HTML, JavaScript and CSS is required. In MVC, detailed knowledge of HTML, JavaScript and CSS is required.
The above abstraction was good but provides limited control over HTML, JavaScript and CSS which is necessary in many cases. Full control over HTML, JavaScript and CSS.
With a lots of control libraries availability and limited knowledge of other related technologies, ASP.NET WebForms is RAD(Rapid Application Development) approach. It's a step back. For developers decrease in productivity.
It’s good for small scale applications with limited team size. It’s better as well as recommended approach for large-scale applications where different teams are working together.

This article explains the pros and cons associated with each model. And in the last point, I concluded which model is suitable in a scenario. Hopefully, it will be a reference for choosing the right approach.

Related Web Development Tutorials


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Written By
Software Developer (Senior) Emaratech
United Arab Emirates United Arab Emirates
Imran Abdul Ghani has more than 10 years of experience in designing/developing enterprise level applications. He is Microsoft Certified Solution Developer for .NET(MCSD.NET) since 2005. You can reach his blogging at WCF Tutorials, Web Development, SharePoint for Dummies.

Comments and Discussions

QuestionExcellent points Pin
Ravikiran72p9-Aug-15 3:59
Ravikiran72p9-Aug-15 3:59 
AnswerRe: Excellent points Pin
Imran Abdul Ghani9-Aug-15 4:03
Imran Abdul Ghani9-Aug-15 4:03 
QuestionImportant Separation; Questionable Opinion Pin
Jason Silvestri8-Apr-15 16:45
Jason Silvestri8-Apr-15 16:45 
QuestionGood explanation Pin
Its Tinku29-Jan-15 3:05
Its Tinku29-Jan-15 3:05 
Generalblasing Pin
Member 1130153713-Jan-15 18:23
Member 1130153713-Jan-15 18:23 
QuestionAbout Article Pin
Amtul Mubeen13-Nov-14 20:28
Amtul Mubeen13-Nov-14 20:28 
AnswerRe: About Article Pin
Imran Abdul Ghani13-Nov-14 23:30
Imran Abdul Ghani13-Nov-14 23:30 
GeneralMy vote of 1 Pin
sridharan.N17-Jun-14 19:24
sridharan.N17-Jun-14 19:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.