views:

85

answers:

2

I am opening a window with window.open and I am losing the server session. Is there a way to open a window with Javascript and use the same session?

I need this working in IE 7 and higher.

I am working with ASP.NET on the server side. The sever does not have a sessionless cookie state. <sessionState mode="InProc" timeout="15" />

+1  A: 

I don't know what server side language you are working with, but usually, you can use a GET parameter to populate your session into the new window.

In PHP, you could use something like this:

window.open("newurl.php?PHPSESSID=<? echo session_id(); ?>");

I think PHP continues the session using the ID it got that way (never tried it actually but should work). If not, you would check for the existence of the GET variable, and force the session ID upon the script using session_id() with the ID as parameter before session_start().

Pekka
+1  A: 

It looks like you have enabled cookieless session state.

The approach for ASP.NET is similar to the one Pekka mention for PHP, but you need to call

window.open("/(S(<%= Session.SessionID %>))/NewPage.aspx");

Or change your web.config to force cookies for sessions.

Residuum
It is weird... there it is using cookies
Phobis