Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to manage one Session Per Tab?

Hi I will like to imitate the behaviour of the site ClickBank.com, for example:

Open the site, and login, if i open a tab with the same site, it ask me again to login.

It makes me wonder how to manage one session per tab.

Just to clarify, i don't loose control on the first tab if i log on in the new tab. They are separate sessions.

Thank you

like image 293
Sanchitos Avatar asked Feb 03 '11 18:02

Sanchitos


People also ask

Do tabs share the same session?

The sessions are always shared trough all tabs. If two different Sessions are enough, you could use a privat/incognito browser window. A other solution could be to use HTML 5 SessionStorage for your variables.

Does session storage work across tabs?

Right, sessionStorage is not shared across tabs. The way I solved it is by using localStorage events. When a user opens a new tab, we first ask any other tab that is opened if he already have the sessionStorage for us.

How do I stop multiple logins on the same browser on different tabs?

call logout function. After login clear the Local Storage. While clicking login - > CLEAR_USER_SESSION - > Y - This will logout other session's of the same application in the same browser as per the below code. After login - change the value to N or empty - CLEAR_USER_SESSION - > 'Y' or ''.

Is each tab a new session?

Every browser tab uses the same Session for a single domain. State within a browser tab can be managed or tracked using the URL (HTTP GET) or a form field (HTTP POST).


1 Answers

Create a hidden field with a page ID and include that when you are trying to access whatever object in session Assign a random guid or value to that hidden control and then use it to store stuff in session

ex.

Session(PageID.Value & "CheckBoxes") = D

Hope that help!

asp.net - session - multiple browser tabs - different sessions?

like image 57
Micah Armantrout Avatar answered Oct 08 '22 15:10

Micah Armantrout