Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When to use ASP.NET MVC vs. ASP.NET Web Forms?

Tags:

One of the common questions asked regarding ASP.NET MVC is why should you use it over ASP.NET Web Forms? The answer generally includes ViewState and clean URLs, amongst others. Towards the end you'll find a blurb about using the right tool for the job and that they serve different purposes. However, I don't believe I've ever seen what those purposes are. So, when would you actually choose ASP.NET MVC over ASP.NET Web Forms, or ASP.NET Web Forms over ASP.NET MVC?

like image 273
Chris Stewart Avatar asked Jul 17 '09 15:07

Chris Stewart


1 Answers

You don't choose ASP.Net MVC over ASP.Net, because ASP.Net MVC still is ASP.Net. You do choose ASP.Net MVC or ASP.Net Web Forms, and there are lots of good reasons to do that:

  • Easier to get control over your HTML
  • Easier to do unit testing
  • Few "Gotchas"

On the other hand, Web Forms do have a few points in their favor:

  • Easy to put simple CRUD/business apps together extremely fast
  • Hard to beat ViewState performance in local LAN environment
  • Easy to learn forms paradigm

The result is that if you're building business apps in a corporate LAN environment (which honestly is still most web developers), Web Forms is really great. In that sense Microsoft really knows their market. But if you're building an app for the public internet, you might want MVC so you can test thoroughly and be sure your pages aren't bloated with unnecessary ViewState or JavaScript data.

Additionally, something that has changed over the last several years is that even many corporate intranet applications now need to support home/remote use, making MVC more attractive to that crowd than it had been.

like image 91
Joel Coehoorn Avatar answered Sep 21 '22 13:09

Joel Coehoorn