Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
253 views
in Technique[技术] by (71.8m points)

.net - ASP.NET Web Forms and ASP.NET Web Pages

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...