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.
我们有一个很大的经典asp应用程序,我们考虑迁移到asp.net或php。我不想谈论任何一个的利弊,但我想知道在迁移到php时是否有办法避免一次完全重写。我们根本无法停止维护当前的代码库只是为了重写。所以事情必须齐头并进。
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?
如果我们转移到asp.net,我们应该能够在两种技术之间共享会话数据,并将部分网站替换为新的asp.net代码,而其他部分则继续运行。这种方法可以用PHP吗?有没有人有这种迁移的经验,或者可以给我一些好的读数?
4 个解决方案
#1
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.
在ASP Classic和ASP.NET之间共享会话状态的能力不是任何一种语言的固有特征,尽管它很容易实现。
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
Microsoft提供示例代码:http://www.google.com/search?client = safari&rls = en-us&q = share%20session%20data%20 between%20ASP%20 %% 20ASP.NET%20pages&ie = UTF-8&e = 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.
通过使用Microsoft的示例,您可以非常轻松地在PHP中实现类似的功能。基本上你使用上面微软代码的ASP Classic部分。然后在PHP中,您将编写一个相当简单的类,以便在加载每个页面时将数据库中的会话状态读取到数组或集合中。这是PHP的一些额外工作,但不应超过几天的编码和测试。
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.
在我有限的经验中,PHP在IIS6上运行得相当不错,并且在IIS7中对它的支持应该更好。我遇到的唯一问题是,大多数PHP代码都假设你在Linux / Unix上运行......但通常这只是文件处理代码的一个问题(想想:用户图像上传)适用于本地文件系统路径。因为他们假设您的文件系统在Windows上使用/而不是\ like。修复显然相当微不足道。
Good luck!
#2
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.
是;可以在单个Web应用程序上共享ASP和ASP.NET页面之间的会话数据。我们在工作中使用遗留代码来实现这一点。
I know it's possible to run PHP on the IIS. Not sure about sharing sessions between ASP and PHP scripts though.
我知道可以在IIS上运行PHP。不确定在ASP和PHP脚本之间共享会话。
#3
"I'd rather like to know whether there are ways to avoid a complete rewrite in one shot when migrating to php"
“我宁愿知道在迁移到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.
我们的FogBugz代码库是用经典的ASP编写的,当我们想在Linux上提供它时,最简单的解决方案就是编写一个读取asp并发出php的编译器。这并不困难,并且不会花费超过几周的时间。
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.
好处是当我们决定将整个应用程序切换到.NET时,它只意味着调整编译器以输出.Net对象代码。
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.
但回到你的答案,ASP和PHP是非常非常相似的,根据你的应用程序,有真正天真的翻译,可能会让你大部分的方式。
#4
Just another option. John Booty has a good suggestion too.
只是另一种选择。 John Booty也有一个很好的建议。
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.
如果会话数据不是敏感信息,您可以使用cookie,这也将是平台无关的,等待用户启用了cookie。
That's probably not your best option given the post but another to think about.
考虑到这个帖子,这可能不是你最好的选择,而是考虑另一个。
#1
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.
在ASP Classic和ASP.NET之间共享会话状态的能力不是任何一种语言的固有特征,尽管它很容易实现。
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
Microsoft提供示例代码:http://www.google.com/search?client = safari&rls = en-us&q = share%20session%20data%20 between%20ASP%20 %% 20ASP.NET%20pages&ie = UTF-8&e = 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.
通过使用Microsoft的示例,您可以非常轻松地在PHP中实现类似的功能。基本上你使用上面微软代码的ASP Classic部分。然后在PHP中,您将编写一个相当简单的类,以便在加载每个页面时将数据库中的会话状态读取到数组或集合中。这是PHP的一些额外工作,但不应超过几天的编码和测试。
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.
在我有限的经验中,PHP在IIS6上运行得相当不错,并且在IIS7中对它的支持应该更好。我遇到的唯一问题是,大多数PHP代码都假设你在Linux / Unix上运行......但通常这只是文件处理代码的一个问题(想想:用户图像上传)适用于本地文件系统路径。因为他们假设您的文件系统在Windows上使用/而不是\ like。修复显然相当微不足道。
Good luck!
#2
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.
是;可以在单个Web应用程序上共享ASP和ASP.NET页面之间的会话数据。我们在工作中使用遗留代码来实现这一点。
I know it's possible to run PHP on the IIS. Not sure about sharing sessions between ASP and PHP scripts though.
我知道可以在IIS上运行PHP。不确定在ASP和PHP脚本之间共享会话。
#3
"I'd rather like to know whether there are ways to avoid a complete rewrite in one shot when migrating to php"
“我宁愿知道在迁移到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.
我们的FogBugz代码库是用经典的ASP编写的,当我们想在Linux上提供它时,最简单的解决方案就是编写一个读取asp并发出php的编译器。这并不困难,并且不会花费超过几周的时间。
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.
好处是当我们决定将整个应用程序切换到.NET时,它只意味着调整编译器以输出.Net对象代码。
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.
但回到你的答案,ASP和PHP是非常非常相似的,根据你的应用程序,有真正天真的翻译,可能会让你大部分的方式。
#4
Just another option. John Booty has a good suggestion too.
只是另一种选择。 John Booty也有一个很好的建议。
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.
如果会话数据不是敏感信息,您可以使用cookie,这也将是平台无关的,等待用户启用了cookie。
That's probably not your best option given the post but another to think about.
考虑到这个帖子,这可能不是你最好的选择,而是考虑另一个。