ASP.NET Web Forms and ASP.NET Web Pages
Asked Answered
T

1

79

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.

Towage answered 27/5, 2011 at 10:7 Comment(0)
S
108

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.

Stiffler answered 27/5, 2011 at 10:21 Comment(12)
Stilger, The pages show the difference, but do we need different IDEs too; such as WebMatrix for web pages?Towage
@stilgar I dont think there is any difference. In the page asp.net/web-forms if you click "Introduction to ASP.NET Web Forms" in section 2 it takes you to msdn.microsoft.com/en-us/library/ms178125.aspx which is about web pages.Kaka
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.Stiffler
@Kaka 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.Stiffler
@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, ??)Towage
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.Stiffler
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?Accompanist
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.Stiffler
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)?Fenske
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.Stiffler
This is an official documentation of Microsoft to describe the difference, whether webmtrix is needed or not for Web Pages: learn.microsoft.com/en-us/aspnet/web-pages/overview/…Tjirebon
Is "ASP.NET Full" an official term?Vesuvius

© 2022 - 2024 — McMap. All rights reserved.