duandang6111 2013-09-05 08:31
浏览 78
已采纳

在经典ASP和PHP之间共享会话而不是使用数据库

We have an ASP intranet web application that have been developed over years which is running on IIS6. Nowadays, we would like to add some new functionalities using PHP language instead. PHP is running fine on the same server. Sessions variables need to be shared between both ASP and PHP.

I am asking if there is other alternatives to share session between classic ASP and PHP instead of using database as gateway (too much resources consuming for us)? Both side need to read/edit session variables.

By tweaking a bit, I've noticed that a PHPSESSID and ASPSESSIONID is generated on PHP side every time a user is logged in the ASP web application. These are also visible on the ASP side, which are stored inside the server Variable HTTP_COOKIE, so I think there may be a correlation between ASP session and PHP sessions variables at the heart of IIS.

So,

-- ASP --

<% Response.write ('HTTP_COOKIE') %> 

gives:

__utma=...; __utmz=...; computer%5Fid=AAA; lan=fre;ASPSESSIONIDXXXXXXXX=BBBBBBBBBBBBBBBBBBBBBBBB; user_login=cccc

-- PHP --

    echo '<pre>';
    var_dump($_COOKIE) ?>
    echo '</pre>';

gives:

Array
(
    [__utma] => ...
    [__utmz] => ...
    [computer_id] => AAA
    [lan] => fre
    [ASPSESSIONIDXXXXXXXX] => BBBBBBBBBBBBBBBBBBBBBBBB
    [user_login] => cccc
)

on ASP side, if I write :

<% Request.Cookies(strCookie)(strKey) %>

in a loop, it gives me bunch list of key/values session cookies stored.

But on PHP side, I can't find a way to get these key/value list. May be it is the way to go and find more? A real existing implementation would help more but any answers are welcome.

  • 写回答

3条回答 默认 最新

  • douzhangcuo2174 2013-09-05 14:46
    关注

    I have used this before for the very same purpose. Try this link http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=9028&lngWId=4

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 飞机曲面部件如机翼,壁板等具体的孔位模型
  • ¥15 vs2019中数据导出问题
  • ¥20 云服务Linux系统TCP-MSS值修改?
  • ¥20 关于#单片机#的问题:项目:使用模拟iic与ov2640通讯环境:F407问题:读取的ID号总是0xff,自己调了调发现在读从机数据时,SDA线上并未有信号变化(语言-c语言)
  • ¥20 怎么在stm32门禁成品上增加查询记录功能
  • ¥15 Source insight编写代码后使用CCS5.2版本import之后,代码跳到注释行里面
  • ¥50 NT4.0系统 STOP:0X0000007B
  • ¥15 想问一下stata17中这段代码哪里有问题呀
  • ¥15 flink cdc无法实时同步mysql数据
  • ¥100 有人会搭建GPT-J-6B框架吗?有偿