迁移经典 ASP - Webforms 还是 ASP.NET MVC? [英] Migrating Classic ASP - Webforms or ASP.NET MVC?

查看:24
本文介绍了迁移经典 ASP - Webforms 还是 ASP.NET MVC?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为我的客户端对一个经典 ASP 应用程序进行一些维护,当我查看 ASP 时,我想到了以下问题 - 将经典 ASP 应用程序转换为 ASP.NET MVC 是否更容易还是 ASP.NET WebForms?

I'm doing some maintenance on a classic ASP application for my client, and as I'm looking through the ASP, the following question comes to mind - would it be easier to convert a classic ASP app to ASP.NET MVC or ASP.NET WebForms?

在许多方面,似乎至少 ASP 的 HTML 可能更容易转换为 MVC,而不是撕掉 HTML 块并将它们转换为 ASP.NET 控件、转发器、数据网格等.另外还有添加 ViewState 的处理和逻辑等可能会添加工作.

In many ways, it appears that at least the HTML of ASP might be easier to convert to MVC than it would be to rip out the HTML chunks and turn them into ASP.NET controls, repeaters, datagrids, etc. Plus having to add in handling and logic for ViewState, etc. might be added work.

我认为我的客户不会要求这样的升级,所以这只是理论上的.

I don't think my client will be requesting any upgrade like this, so this is just theoretical.

让我们假设这个 ASP 代码写得很好(当然这并不总是正确的)所以问题是,一个最佳案例设计良好的 ASP 网站会比 WebForms 更好地迁移到 MVC 吗?

Let's assume that this ASP code is written very well (which isn't always true of course) so really the question is, will a best-case-well-designed ASP site migrate better to MVC than WebForms?

(请注意,我对 ASP.NET MVC 还很陌生,所以我可能在这里遗漏了一些重要的东西).

(Note that I'm very new to ASP.NET MVC, so I might be missing something crucial here).

推荐答案

这在很大程度上取决于经典的 asp 应用程序的结构.

It depends a lot on how the classic asp app is structured.

与 HTML 混合的服务器标签类似于 asp.net mvc,但 MVC 没有那么混乱(或不应该如此).您可能能够将经典的 asp 演示代码移至 MVC 视图,而不是移至 Web 表单.此外,经典的 ASP 应用程序通常在开发时考虑到 Web 的无状态性.您的经典 asp 中可能没有任何内容与 postabacks 或 viewstate 匹配.Classic ASP 也使用普通的 html 元素,而不是 asp.net webform 控件.在这些方面,它与 MVC 的匹配度比 webforms 更接近.

The server tag mixed in with HTML is similar to asp.net mvc but MVC is not as messy (or not supposed to be). You might be able to move the classic asp presentation code to a MVC view easier than to a web form. Also classic asp apps were usually developed with the statelessness of the web in mind. There probably is not anything in your classic asp that matches postabacks or viewstate. Classic ASP also uses normal html elements as opposed to asp.net webform controls. In these respects it matches MVC a lot closer than webforms.

如果你不知道 asp.net webforms 或 asp.net mvc 我会说 MVC 是要走的路.

If you do not know asp.net webforms or asp.net mvc I would say MVC is the way to go.

如果您非常了解网络表单,但对 MVC 了解不多,我会说网络表单是您的最佳选择.

If you know webforms very well and don't know much about MVC I would say webforms is the way to go.

但是,如果您的客户出于某种原因确实想要重新开发网站,我会建议您选择 MVC.只要您可以交付,让客户为您的部分体验开发付费总是很好的.

But, if your client for some reason does want a redevelopment of the site I would say go with MVC. It's always nice to have a client pay for part of your experience development as long as you can deliver.

另一方面,当我遇到一个希望我在他们的经典 asp 网站上工作的客户时,我总是很吃惊.在每种情况下,该网站都是一团糟.更糟糕的是,它们通常充满了巨大的安全漏洞.

On another note I'm always taken aback when I come across a client who wants me to do work on their classic asp site. In every single case the site is a mess. The worse part is that they are usually filled with huge security holes.

这篇关于迁移经典 ASP - Webforms 还是 ASP.NET MVC?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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