当使用ASP.NET MVC与ASP.NET Web窗体? [英] When to use ASP.NET MVC vs. ASP.NET Web Forms?

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

问题描述

一个关于ASP.NET MVC问常见的问题就是为什么你应该使用它在ASP.NET Web窗体?答案通常包括ViewState的和干净的网址,在其他之中。接近年底,你会发现一个有关使用正确的工具的工作,他们服务于不同目的的Blurb。不过,我不相信我所看到的这些目的都是。所以,当你实际选择了ASP.NET MVC ASP.NET MVC在ASP.NET Web窗体或ASP.NET Web窗体?

One of the common questions asked regarding ASP.NET MVC is why should you use it over ASP.NET Web Forms? The answer generally includes ViewState and clean URLs, amongst others. Towards the end you'll find a blurb about using the right tool for the job and that they serve different purposes. However, I don't believe I've ever seen what those purposes are. So, when would you actually choose ASP.NET MVC over ASP.NET Web Forms, or ASP.NET Web Forms over ASP.NET MVC?

推荐答案

您没有选择ASP.Net MVC在ASP.Net,因为ASP.Net MVC的还是的ASP.Net。你选择ASP.Net MVC或ASP.Net Web窗体,并有很多很好的理由这样做:

You don't choose ASP.Net MVC over ASP.Net, because ASP.Net MVC still is ASP.Net. You do choose ASP.Net MVC or ASP.Net Web Forms, and there are lots of good reasons to do that:


  • 更容易得到控制你的HTML

  • 容易做单元测试

  • 几个陷阱

在另一方面,Web窗体确实有利于自己的几点:

On the other hand, Web Forms do have a few points in their favor:


  • 易于把简单的CRUD /商业应用起来非常快

  • 很难被击败的局域网环境
  • ViewState的性能
  • 易于学习形式的范例

  • Easy to put simple CRUD/business apps together extremely fast
  • Hard to beat ViewState performance in local LAN environment
  • Easy to learn forms paradigm

其结果是,如果你在一个企业局域网环境中构建业务应用程序(老实说,这仍是大多数Web开发人员),Web窗体真的很棒。在这个意义上说微软真的了解自己的市场。但是,如果你正在构建的公共互联网的应用程序,你可能想MVC这样你就可以彻底的测试,并确保您的网页不臃肿不必要的ViewState或JavaScript的数据。

The result is that if you're building business apps in a corporate LAN environment (which honestly is still most web developers), Web Forms is really great. In that sense Microsoft really knows their market. But if you're building an app for the public internet, you might want MVC so you can test thoroughly and be sure your pages aren't bloated with unnecessary ViewState or JavaScript data.

此外,一些在过去几年改变的是,甚至有不少企业内部网应用程序现在需要支持家庭/远程使用,使得MVC到人群比它一直更具吸引力。

Additionally, something that has changed over the last several years is that even many corporate intranet applications now need to support home/remote use, making MVC more attractive to that crowd than it had been.

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

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