76

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.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
SocialCircus
  • 2,110
  • 6
  • 24
  • 35

1 Answers1

103

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.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Stilgar
  • 22,354
  • 14
  • 64
  • 101
  • Stilger, The pages show the difference, but do we need different IDEs too; such as WebMatrix for web pages? – SocialCircus May 27 '11 at 10:27
  • @stilgar I dont think there is any difference. In the page http://www.asp.net/web-forms if you click "Introduction to ASP.NET Web Forms" in section 2 it takes you to http://msdn.microsoft.com/en-us/library/ms178125.aspx which is about web pages. – Aravind May 27 '11 at 10:30
  • Yeah Web Matrix is the way to go for Web Pages. I don't really know much about Web Pages (or Web Matrix) and I don't care much. For me it is a toy for hobbyist kind of Microsoft's way to make .NET easy for beginners who want to start with the web. Right now PHP (which is disgusting language in my opinion) is so easy to start and people tend to stick to what they used first and invest more in it. This is why MS created Web Pages to get people started on the web with .NET instead of PHP. – Stilgar May 27 '11 at 10:32
  • @Aravind this is about the concept of a web page in the Web Forms framework. There is a think in Web Forms that is called "page" but not every page on the web is an ASP.NET Web Forms page. An year ago MS introduced Web Matrix as a tool for people to get started. Less than 2 months ago at MIX11 they gave the underlying framework the name ASP.NET Web Pages. – Stilgar May 27 '11 at 10:36
  • @Stilgar, It would be really helpful to all if you can throw something on the difference on "Web Page in Web Forms Framework" and "Web Pages Framework"(I am assuming that the Web Pages is a new framework, ??) – SocialCircus May 27 '11 at 10:47
  • 3
    Web Pages is a framework. I've mentioned some differences. Web Forms uses controls. Web Pages uses Razer syntax to inject serverside (C#/VB.NET) code into a single file representing the page. – Stilgar May 27 '11 at 10:58
  • 1
    Are the names Pages, Forms kind of misleading? To me it seems like Pages are for simple web pages where as Forms are for data entry / surveys that kind of thing. Sounds like they can both accomplish the same things, just the difference is in the development. Am I understanding correctly? – shim Nov 06 '14 at 16:49
  • I wouldn't say that Forms is misleading but I do think "Pages" is misleading especially since ASP.NET already had something called page. They can certainly accomplish the same thing. – Stilgar Nov 06 '14 at 17:01
  • So If I were to boil it down, would ASP.NET Web Pages really be targeting those developers who come from something like a PHP background (where your predominantly embedding server side code into HTML)? – Chris Smith Jan 18 '17 at 15:33
  • Honestly I don't know what they were targeting. Maybe they built it because they could (when they built the Razor view engine they had all the pieces) or thought that it will be better for beginners. I've yet to meet a person who uses this in practice. – Stilgar Jan 18 '17 at 15:52
  • This is an official documentation of Microsoft to describe the difference, whether webmtrix is needed or not for Web Pages: https://learn.microsoft.com/en-us/aspnet/web-pages/overview/getting-started/aspnet-web-pages-razor-faq#Whats_the_difference_between_ASP.NET_Web_Pages,_ASP.NET_Web_Forms,_and_ASP.NET_MVC – M.Hassan Oct 29 '17 at 10:09
  • Is "ASP.NET Full" an official term? – Peter Mortensen Apr 04 '20 at 22:16