Stephen R
Stephen R

Reputation: 3907

Set SessionId in Classic ASP?

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?

Upvotes: 0

Views: 2996

Answers (2)

Kul-Tigin
Kul-Tigin

Reputation: 16950

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?

Upvotes: 3

multinett
multinett

Reputation: 1

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
%>

Upvotes: 0

Related Questions