如何共享之间的PHP和ASP.net应用程序会话? [英] How to share sessions between PHP and ASP.net application?

查看:156
本文介绍了如何共享之间的PHP和ASP.net应用程序会话?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我公司采取了一些旧PHP应用程序了。由于我们的preference以ASP.net和缺乏从previous开发商的任何文件,我们不希望花费在PHP开发多少资源。
为了实现新的功能,我们将创建一个具有相同的外观给用户的Asp.net应用程序。我们要发展一种共存的Web应用程序。因此,我们必须共享一个PHP和Asp.net web应用项目之间的会话,因为没有涉及到现有的MySQL数据库usermanagement。

My company took some old php application over. Due to our preference to ASP.net and to the lack of any documentation from the previous developer, we do not want to spend much resources on developing in PHP. For implementing new features, we will create an Asp.net application that has the same look to the user. We want to develop a kind of 'coexisting' web application. Therefore we must share sessions between an PHP and an Asp.net webapplication project, because there is a usermanagement involved with an existing MySQL database.

(例如,链接'A'定向到PHP的网站,并链接'B'定向到asp.net应用程序)

(e.g. link 'A' directs to the PHP website, and link 'B' directs to the asp.net application)

我们怎样才能和PHP和asp.net应用程序之间共享会话?

How can we share the session between and PHP and an asp.net application?

和没有任何人有一个提示为这个'共存'的东西​​,这可能是在发展有用吗?

And does anyone have a hint for this 'coexisting' thing, that might be useful in development?

修改:IIS 6将是我们的目标服务器,altough IIS 7.5也将是一种选择

Edit: IIS 6 would be our targeted server, altough IIS 7.5 would also be an option

推荐答案

我想告诉你,我怎么会做这件事。

I want to tell you, how I ended up doing it.

这两个应用程序访问MySQL数据库并访问会话表,其中包括一个GUID,用户的ID,以及一个confirmationString(我猜我带$ C $光盘ID用户在里面,不知何故)和日期。

Both applications access a MySQL database and access a "session" table, which consists of a Guid, the ID of the user, and a confirmationString (I guess I encoded the IDUser in it, somehow) and a date.

会话仅由PHP应用程序启动(由于这样的事实,即PHP应用程序仍是主要的应用程序)。一个新的会话将导致在日志表中的新条目。 PHP应用程序中每一个环节,链接到ASP.Net应用程序包含GET参数,包含的GUID等。

Sessions are only started by the PHP application (due to the fact, that the PHP application is still the main application). A new session will result in a new entry in the log table. Every link in the PHP application, that links to the ASP.Net application contains GET-Parameters, containing the Guid etc.

对于GET-参数ASP.net应用程序检查并设置ID用户在ASP.Net会话,如果GET参数指向现有的会话。

The ASP.net application checks for the GET-Parameters and sets the IDUser in the ASP.Net Session, if the GET-Parameters point to an existing session.

指回PHP应用程序的链接使用相同的技术。

The links pointing back to the PHP application use the same technique.

(还有其他事情要考虑,比如超时或注销,但可以处理为好)

(There are also other things to consider, like timeouts or logouts, but that can be handled as well)

所有的一切,我会说,我的方法是有用的,因为部署没有客户抱怨(超过1年前)

All in all, I'd say that my approach is useful and none of the customers complained since the deployment (over 1 year ago)

这篇关于如何共享之间的PHP和ASP.net应用程序会话?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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