ASP.NET Web 窗体和 ASP.NET 网页 [英] ASP.NET Web Forms and ASP.NET Web Pages

查看:43
本文介绍了ASP.NET Web 窗体和 ASP.NET 网页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

ASP.NET Web 窗体和 ASP.NET 网页之间有什么区别?

此处表示网页和 Web 表单是不同的方法.

解决方案

ASP.NET Full 分为三种版本,还有 ASP.NET Core(适用于 Linux 和 Mac 的新版本).

对于 ASP.NET 完整版

第一个是最古老的,称为 Web 表单.基本上,它是一个面向组件的高级 Web 框架,可与封装行为和视图的按钮和网格等控件配合使用.

它是 ASP.NET 中最流行的风格,但因缺乏对生成的标记的控制而受到批评.目前大多数新项目都是 ASP.NET MVC,但肯定有很多 Web 窗体代码.虽然这是我个人的最爱,但我必须指出,这是开始学习 Web 编程的一种糟糕方式,因为它向您隐藏了实现细节(当您有经验时这很好)并且学习起来有点复杂.

来源:http://www.asp.net/web-forms

ASP.NET MVC 是 ASP.NET MVC 模式的实现.有些人声称,与使用 Web 表单相比,使用此框架通过单元测试和良好的关注点分离来开发可维护的应用程序更容易.

我不同意这一点,并认为使用像 MVP 这样的模式可以通过 Web Forms 实现相同的效果.另一方面,ASP.NET MVC 有一个很大的优势——它允许完全控制生成的标记.这对于现代风格的 Web 开发非常重要,其中很多事情都由 JavaScript 控制.例如,在 MVC 视图之上添加精美动画比在 Web 窗体之上更容易.

来源:http://www.asp.net/mvc

ASP.NET 网页是(目前)针对小型项目和初学者开发人员(至少在我看来)的最新版本.它适用于开发约 10 页的较小项目.大多数逻辑都写在每页一个文件中,我称之为基本 PHP 风格".它使用 Razor 语法来注入服务器端代码.

来源:http://www.asp.net/web-pages

请注意,Web 窗体使用页面(与 MVC 不同),因此混淆了 ASP.NET 网页是什么.

对于 ASP.NET Core,使用了新版本的 ASP.NET MVC,它在概念上与上述 ASP.NET MVC 相同.有趣的是,从 ASP.NET Core 2.0 开始,还有一种叫做 Razor Pages,本质上是 ASP.NET 网页的更高级版本.

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.

解决方案

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.

这篇关于ASP.NET Web 窗体和 ASP.NET 网页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆