ASP.NET Web Forms and ASP.NET Web Pages

SocialCircus picture SocialCircus · May 27, 2011 · Viewed 51.9k times · Source

What is the difference between ASP.NET Web Forms and ASP.NET Web Pages?

Here it says that Web Pages and Web Forms are different approaches.

Answer

Stilgar picture Stilgar · May 27, 2011

There are three flavors of ASP.NET Full and there is also ASP.NET Core (the new one that works on Linux and Mac).

For ASP.NET Full

The first one is the oldest and is called Web Forms. Basically it is a high-level component-oriented web framework that works with controls like buttons and grids that encapsulate behaviour and view.

It was the most popular flavor of ASP.NET, but it has been criticised for the lack of control over the generated markup. Currently most new projects are ASP.NET MVC, but there is definitely a lot of Web Forms code out there. While this is my personal favorite, I must point out that it is a bad way to start learning web programming, because it hides the implementation details from you (which is good when you have experience) and is a bit complex to learn.

Source: http://www.asp.net/web-forms

ASP.NET MVC is an implementation of the MVC pattern for ASP.NET. Some people claim that it is easier to develop maintainable applications with unit tests and good separation of concerns with this framework than it is with Web Forms.

I disagree on this point and think that using patterns like MVP one can achieve the same with Web Forms. On the other hand, ASP.NET MVC has one big advantage - it allows full control over the generated markup. This is very important for the modern style of web development where a lot of things are controlled with JavaScript. For example, adding a fancy animation is easier to do on top of an MVC view than it is on top of a Web Form.

Source: http://www.asp.net/mvc

ASP.NET Web Pages is a (currently) the latest flavor that is targeted at smaller project and beginner developers (at least in my opinion). It is good for developing smaller projects with ~ 10 pages. Most of the logic is written in a single file per page in what I call "Basic PHP style". It uses the Razor syntax for injecting the serverside code.

Source: http://www.asp.net/web-pages

Note that Web Forms uses pages (unlike MVC), and therefore there is a confusion what ASP.NET Web Pages is.

For ASP.NET Core, a new version of ASP.NET MVC is used that is conceptually the same as the ASP.NET MVC described above. Interestingly, as of ASP.NET Core 2.0, there is also something called Razor Pages which is essentially a more advanced version of ASP.NET Web Pages.