Session problem

P

Puja

hi all,



I have a problem.



In my login page, after user logs in, I store userId in session.



Now after logging in, they come to page where I have a button called
"Preview site".



What I want to do is when user clicks on Preivew Site which opens a new
window, I want to clear out "UserId" stored in session only for this new
window.



Previously opened window by user should still have "UserId" in session and
user should be able to navigate thro' pages.



What is now happening is when I click "Preview Site" am still able to acces
"userId" stored in session from the new window.



Does anybody know how I can do this ?



Thanks



puja
 
A

Alberto Poblacion

Puja said:
What I want to do is when user clicks on Preivew Site which opens a new
window, I want to clear out "UserId" stored in session only for this new
window.

Does anybody know how I can do this ?

The server knows what your session is thanks to a cookie that is sent by
the browser that contains a 120-bit number which is the session ID. When you
open a new window from an existing one, the browser still sends from the new
window the same cookies as it had in the old window, so the server "sees"
the same session. You could force a new session by deleting the session
cookie, either by using the Cookies collection on the server, or by sending
some javascript to your new window that removes the cookie and reloads the
page.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top