Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Dear Friends,

I am facing a problem where i have to restrict the user to work on multiple tabs in with the help of multiple sessions.

If a user login(s) into the web application then if the user opens a new tab with the same URL of the existing web application opened earlier then the session doesn't get logged out instead it shows me the same window with session login.

I want to prevent it to happen like all Bank sites does this. Whenever we login into our account and if we open a new tab with already opened bank URL then the session logs out.

How they do I want to know.

Thanks

Varun Sareen
Posted
Updated 8-May-17 1:29am
Comments
anthony mary 10-Jul-13 7:10am    
try having a cookies instead of sessions
Varun Sareen 10-Jul-13 7:17am    
no cookies. please give me some another solution. As i can't change my whole application. And do let me know how it can be done.

This is somewhat tedious task because session is stored at server side and server would not be aware of what is being done at client side as per as the browser window is concerned.Also you have to handle it in such a way that works for all modern browsers.You can make use of cookies or session ID(along with URL rewritting techniques).Well,refer to below link in order to have some idea regarding the same.

ASP.NET Session State shared between IE Tabs and IE8[^]

Avoid sharing of same session across multiple tabs in internet explorer for java based web application.[Java][^]

Get an unique session in each browser tab[^]

How to differ sessions in browser-tabs?[^]

Regards.. :laugh:
 
Share this answer
 
Comments
Varun Sareen 10-Jul-13 7:49am    
Thanks rohan friend, But no help :(
The server has no concept of tabs or even browsers, it has no idea if the user has requested the url from the same tab or a different one. All it has to persist across requests are cookies and if your tabs share cookies is down to how your browser works.

So basically there is nothing you can really do about this.
 
Share this answer
 
Comments
Varun Sareen 13-May-17 23:49pm    
I respect your answer but have you ever opened a Bank site with multiple tabs?
Varun Sareen 13-May-17 23:54pm    
I respect your answer but have you ever tried the bank site in different tabs?
Varun Sareen 14-May-17 1:11am    
Yes we can do as in bank sites for example.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900