Difference betweeen ASP.NET WebForms and ASP.NET MVC

By | October 13, 2013

If you are visiting ASP.NET forums and communities, you will find 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?
  • MVC vs Webforms or ASP.NET Webforms Vs MVC model?

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

MVC Vs WebForms

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. Although both has pros and cons, that we will discuss and compare here.

ASP.NET Web Forms
ASP.NET Web Forms uses Page controller pattern approach for rendering layout. In this approach, every page has it’s 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 it’s 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 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 here 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.
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 last point, I concluded that which model is suitable in a scenario. Hopefully, it will be a reference for choosing the right approach.

Top 10 Interview Questions and Answers Series:

  • http://www.blogger.com/profile/17454371291070199748 Munazzah

    very nice

  • http://www.blogger.com/profile/02679564686256946516 Saheli Henderson

    This comment has been removed by a blog administrator.

  • http://www.blogger.com/profile/04260988491473821504 Gajab

    Once you start using MVC, you will love it and nevel look back at web forms once you are comfortable with MVC. Clean simple, fast and scalable

    • http://www.blogger.com/profile/10867674357364468276 Imran Ghani

      Yes, true undoubtedly. But Gajab, still we have a bulk of old applications developed using Web Forms. Also for small scale application, its rapid approach.

  • http://www.blogger.com/profile/09828448595834731682 Sivakumar Aruchamy

    Excellent. Very nice comparison!!!. Good Job. Keep it up!!!

  • http://www.blogger.com/profile/16081925109725688872 GS

    Excellent comparison! It was very useful to me. Thank you.

  • Cheriyanveetil Vipin

    good one, pls refere below site also which I was earlier refering


  • http://www.webdevelopmenthelp.net/ WebdevTutorial

    On behalf of barry ferrell.

    Name: barry ferrell
    Email: barry@geerservices.com
    Comment: I’d like to read your entire comparison of mvc vs asp.net web forms.


    We are looking to convert a classic asp site to a .net site and I’d like to be able to make an educated decision on which approach to take.

    Thank you,
    Barry Ferrell