Set SessionId in Classic ASP?

妖精的绣舞 提交于 2019-12-12 03:48:52

问题


In PHP I can choose to use a particular Session by using Session_id() as a setter.

Is there any similar functionality in Classic ASP/VBScript? I have an VBScript site that, depending on the page, is either called directly from the browser or internally via HTTP. Unfortunately ASP treats these as two separate sessions, because the User's computer calls one and the Server itself calls the other. I want to tell the Server calls, "Hey, use Session 123456" so it can share info with the user calling pages directly.

Any advice? Any way to change or name the Session being used on a page?


回答1:


There's no built-in method like PHP's Session_id() in ASP Classic.

ASP's Session object has a strict locking mechanism that guarantees consistency of the state, so this prevents you to make additional requests with the same session identifier within the same application pool.

On the other hand it's easy to implement a bridge to share the session state with a different platform like PHP under the same domain.


How to access ASP classic session variable from PHP?




回答2:


I'm not sure that I understood your problem correct. You need a variable for each user? Why didn`t you use an application variable?

<%
    x=session.sessionID
    if not instr(application("x"),x)>0 then
       application("x")=application("x") & x &";"
    end if

    aArr=split(application("x"),";")

    for i=0 to ubound(aArr)
        REM this will show you all used session.variables
        response.write aArr(i)&"<br>"
    next
%>


来源:https://stackoverflow.com/questions/43357406/set-sessionid-in-classic-asp

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!