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?
  • ASP.NET MVC vs ASP.NET WebForms | ASP.NET WebForms Vs MVC model?

In this web development tutorial, We’ll try to answer and explain such queries.ASP.NET MVC Vs ASP.NET 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.

Before going into deeper details let’s have a high level comparison as:

ASP.NET MVC Vs ASP.NET WebForms***ASP.NET WebForms developers migrating to ASP.NET MVC initially feel a little uncomfortable because they are unable to find many key features that were available in WebForms approach. There are many questions comes to their minds like below:

  • Web is still stateless but where is the Viewstate?
  • Where is that Code behind file?
  • What is that Razor syntax? Why I need it?
  • Where to find Page_Load method? that is used to put code for almost every page.
  • What about Binding and Rich Server Controls? Where these controls gone?
  • and many more…

Exam 70-486

ASP.NET MVC vs ASP.NET WebForms

Following table explains the difference to answer above questions by clearly explaining the limitations of each approach.


ASP.NET Web Forms


ASP.NET MVC

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. Please follow here for demo on building testable applications.
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.

Q1. Choose the correct built-in ActionResult types in ASP.NET MVC [Choose Three]?

  • A. ViewResult
  • B. ASPViewResult
  • C. EmptyResult
  • D. PartialViewResult
  • E. RazorViewResult

Q2. You developed an ASP.NET MVC application for WebDevTutorial that must be secured using SSL. You are ready to deploy the application to production. The deployment package must include the installation of the SSL certificate. You need to configure the deployment package to meet the requirement. What should you do?

  • A. In the Package/Publish settings of the project, select the All Files in this project option.
  • B. In the Build Events settings of the project, configure a pre-build event to include the SSL certificate.
  • C. Extend the CopyAllFilesToSingleFolder target in the project file.
  • D. Create a web publish pipeline target file with a custom web deploy target.

For a complete ASP.NET and ASP.NET MVC online test and Practice Exams, Click Here.

 Q1: Correct Answers: A, C, D
 Q2: Correct Answer: D

Further, if you are interested to practically learn ASP.NET MVC5, a recommended Video Series especially designed for those familiar with ASP.NET WebForms, follow here.

  • Over 28 lectures and 2.5 hours of content!
  • User will be able to understand ASP.NET MVC 5 and some important parts of the architecture like Modules, Routing, Controllers, Validations, ViewModel of MVC, Code First Approach etc.
  • Complete Course Curriculum here.

More You Must Read about ASP.NET MVC & Related

Top 10 Interview Questions and Answers Series:

13 thoughts on “Difference betweeen ASP.NET WebForms and ASP.NET MVC

  1. 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

    1. 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.

  2. GS

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

  3. North Gork

    This is a really good comparison, well done. I am not sure I agree with some of your comparisons though. The “separation on concerns” issue is not true as you can create your own Model, View, Controller, its called OOD and it has been around for a very long time. If I want to separate the presentation layer from the business and data layer I can do that by creating an assembly of classes that separate the layers. This is standard OOD. I think MVC in this context is for those that do not fully grasp OOD.

    Your point on viewstate is also incorrect. You can turn if off if you do not want to use it and there are many other ways to minimize viewstate in large scale environments. You also have other options for creating viewstate on a large scale deployment. Again, this shows you do not fully understand the .NET Framework and how to use it.

    I also do not think the MVC request cycle is as simple as you suggest as you have to know the MVC model, which classes to implement, how they interact, and then you have to be a guru in CSS and JQuery. Hardly what I would call simple compared to the page model.

    You also say in ASP.NET you do not have full control over CSS, HTML and JQuery. This is false. You have complete control. However, in ASP.NET you do not have to worry about client side crap if you choose not to. You should at least implement CSS as a separate maintainable file instead of using inline CSS, but the choice is yours to make. You can also use jquery in the html if you want to, but its not really needed.

    I do agree MVC is a step backwards that caters mainly for jquery/html client side developers that do not understand Visual Studio, the .NET Framework and C# in general.

    The only possible advantage I can see with MVC is that it may do responsive design a little better due to the jquery client side features. It is also easier for client side scripting developers to understand because it is heavily based on html, jquery and css. Its really for client side developers that lack the .NET Framework experience.

    Good effort though, but certainly open for debate.

  4. Radu Porumb

    While it’s true you can architect WebForms (and anything else for that matter) into a clean, well built piece of software, I believe the point of MVC is to push inexperienced developers into writing cleaner, more organized software right off the bat while providing a clean, easy framework to use for experienced developers. And while the starting learning curve is definitely a lot steeper than something like vanilla PHP for instance, the time spent there is gained back during maintenance where problems are a lot more easily identified and corrected.

    The MVC request cycle is dead simple, provided you understand how HTTP servers work. IIS receives a request and forwards it to MVC, then MVC uses the routing engine on the request URL to identify the controller and action it needs to invoke, uses the model binder on any url/request body parameters and invokes the action using the parameters obtained from the model binder.

    Regarding the whole “you have to be a CSS/jQuery guru” argument, I believe that’s an exaggeration. But you do have to know your way around HTML/CSS/JS because this isn’t “Fisher-Price: My First Website” or some kind of drag & drop “Hour of Code” assignment. WebForms can bite you in the ass just as badly as anything else if you’re clueless about client-side stuff and most of the front-end help it provides is, at best, clunky.

    I can also tell you that this whole “let framework magic handle client-side stuff, I don’t wanna dirty my hands with it” would be a complete nonstarter at any serious web dev shop. This kind of attitude is cancerous and it tends to put a very low ceiling on a person’s career. If you want to be just another drone in a cubicle hacking away at the same thing every day for years on end and only getting promoted because of office politics, keep limiting yourself and what you can learn. On the other hand if you want to rise in the ranks quickly, be independent (read: not tied down to one job) and make better and better money, you have to continuously expand your knowledge and avoid shooting down things before you’ve seen everything they have to offer.

    I bet if you had a look at how far Javascript and CSS have come during the past few years you’d be pretty surprised. For instance, you can now use JS code-behind (using this excellent NuGet package) for pages, while keeping an MVC structure on the server side.

    1. WebdevTutorial

      Agree with you on most of the points especially the maintenance issues resolution but in this article we are comparing both model with a point in mind that audience can be a developer having background in VB and classic ASP, later moved to ASP.NET.

  5. abhishek maheshwari

    I think this can be useful for your question.

    -ASP.NET MVC does not use View State to record state information whereas ASP.NET web form uses View State to record state information.
    -ASP.NET Web forms are better for Rapid application development in the case if you small development team. ASP.NET MVC is better for large project where you give more priority to testability and maintainability.

    -In ASP.NET Web form View is called after controller wherein ASP.NET MVC the rendering of View is managed by controller based on the action.

    -ASP.NET Web forms development is easy to learn compared to ASP.NET MVC development.

    Source:- http://tech.queryhome.com/136447/what-the-difference-between-asp-net-mvc-and-asp-net-webforms

Comments are closed.