将大型经典 ASP 页面迁移到 php?

发布于 2024-07-16 01:56:10 字数 264 浏览 2 评论 0原文

我们有一个大型的经典 asp 应用程序,我们考虑迁移到 asp.net 或 php。 我不想谈论两者的优缺点,但我更想知道在迁移到 php 时是否有办法避免一次性完全重写。 我们不能只是为了重写而停止维护当前的代码库。 所以事情必须齐头并进。

如果我们要迁移到 asp.net,我们应该能够在两种技术之间共享会话数据,并用新的 asp.net 代码替换网站的部分内容,而其他部分则继续运行。 这种方法可以用php实现吗? 有谁有此类迁移的经验或者可以给我指出一些好的读物吗?

We've got a large classic asp application and we consider migrating to either asp.net or php. I don't want to talk about the pros and cons of either one, but I'd rather like to know whether there are ways to avoid a complete rewrite in one shot when migrating to php. We simply can't stop maintaining the current codebase just to do a rewrite. So things have to go hand in hand.

If we'd move to asp.net, we should be able share session data among both technologies and have parts of the site replaced with new asp.net code, while other just keep on running. Is such an approach possible with php? Does anyone has got experiences with such a migration or could point me to some good readings?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

笔芯 2024-07-23 01:56:10

在 ASP Classic 和 ASP.NET 之间共享会话状态的能力并不是这两种语言的固有功能,尽管它相当容易实现。

微软提供了示例代码:
http://www.google.com/search?client=safari&rls=en-us&q=share%20session%20data%20 Between%20ASP% 20and%20ASP.NET%20pages&ie=UTF-8&oe=UTF-8

通过使用 Microsoft 的示例,您可以非常轻松地在 PHP 中实现类似的功能。 基本上您会使用上面 Microsoft 代码的 ASP Classic 部分。 然后在 PHP 中,您将编写一个相当简单的类,以便在加载每个页面时将会话状态从数据库读取到数组或集合中。 在 PHP 中,这是一些额外的工作,但应该不会超过几天的额外编码和测试。

根据我有限的经验,PHP 在 IIS6 上运行得很好,并且在 IIS7 中对 PHP 的支持据说更好。 我遇到的唯一障碍是大多数 PHP 代码都假设您在 Linux/Unix 上运行......但通常这只是文件处理代码的问题(想想:用户图像上传)适用于本地文件系统路径。 因为他们假设你的文件系统使用 / 而不是像 Windows 上的 \ 。 显然修复起来相当简单。

祝你好运!

The ability to share session state between ASP Classic and ASP.NET isn't an intrinsic feature of either language, though it's fairly easy to accomplish.

Microsoft provides sample code:
http://www.google.com/search?client=safari&rls=en-us&q=share%20session%20data%20between%20ASP%20and%20ASP.NET%20pages&ie=UTF-8&oe=UTF-8

By using Microsoft's example, you could pretty easily implement something similar in PHP. Basically you'd use the ASP Classic portion of Microsoft's code above. Then in PHP you'd write a fairly simple class to read session state from the database into an array or collection when each page is loaded. It's a little extra work in PHP, but shouldn't be more than a few extra days of coding and testing.

PHP runs pretty well on IIS6 in my limited experience and support for it is supposedly even better in IIS7. The only snag I've hit in is that a most of the PHP code out there assumes you're running on Linux/Unix... but generally this is only an issue for file-handling code (think: user image uploads) that works with local filesystem paths. Because they assume your filesystem uses / instead of \ like on Windows. Obviously fairly trivial to fix.

Good luck!

没有心的人 2024-07-23 01:56:10

是的; 可以在单个 Web 应用程序上的 ASP 和 ASP.NET 页面之间共享会话数据。 我们在工作中使用遗留代码来做到这一点。

我知道可以在 IIS 上运行 PHP。 但不确定 ASP 和 PHP 脚本之间是否共享会话。

Yes; it is possible to share session data between ASP and ASP.NET pages on a single web application. We do that with our legacy code at my work.

I know it's possible to run PHP on the IIS. Not sure about sharing sessions between ASP and PHP scripts though.

っ左 2024-07-23 01:56:10

“我更想知道在迁移到 php 时是否有办法避免一次性完全重写”

欢迎来到我们的世界。

我们的 FogBugz 代码库是用经典 ASP 编写的,当我们想在 Linux 上提供它时,最简单的解决方案是编写一个读取 asp 并发出 php 的编译器。 这并不困难,而且只花了几周的时间。

好处是,当我们决定将整个应用程序切换到 .NET 时,这只意味着稍微调整编译器以输出 .Net 目标代码。

但回到你的答案,ASP 和 PHP 非常非常相似,并且根据你的应用程序,有一些非常简单的翻译器可能会帮助你完成大部分工作。

"I'd rather like to know whether there are ways to avoid a complete rewrite in one shot when migrating to php"

Welcome to our world.

Our FogBugz codebase was written in classic ASP and when we wanted to offer it on Linux, the simplest solution was to write a compiler which read the asp and emitted php. It wasn't that difficult, and didn't take more than a few weeks.

The upside was when we decided to switch our entire application to .NET it only meant tweaking the compiler a bit to output .Net object code.

But to get back to your answer, ASP and PHP are VERY VERY similar and depending on your app there are really naive translators that might get you most of the way there.

失退 2024-07-23 01:56:10

只是另一种选择。 John Booty 也有一个很好的建议。

如果会话数据不是敏感信息,您可以使用 cookie,这也将与平台无关,等待用户打开 cookie。

鉴于这篇文章,这可能不是您的最佳选择,而是另一个需要考虑的选择。

Just another option. John Booty has a good suggestion too.

If the session data isn't sensitive information you can work cookies which will also be platform agnostic pending the user has cookies turned on.

That's probably not your best option given the post but another to think about.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文