getting then session ID

  • Thread starter Thread starter PJ6
  • Start date Start date
P

PJ6

Is is possible to get the session ID in JavaScript when using ASP.NET in
cookieless mode?

The reason I ask is that one of the functions I want to perform using remote
scripting (AJAX) is a page location redirect. When the session is cookieless
I want to respect the session ID contained in the current URL.

Paul
 
Isn't it a simple mater of parsing the path information?

var path = window.location.pathname;
var sessionId = path.substring(path.indexOf("(")+1, path.indexOf(")"));

will work so long as none of your paths' use ( or )

Karl
 
I wanted to avoid that for that very reason...

But now that I think about it indexOf returns the first occurance in a
string. I don't think I'll have anything to worry about since the SessionID
comes before everything except the site name.

Thanks,
Paul
 
Back
Top