Click here to Skip to main content
15,887,214 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

I have a website where user can login to any browser(Mostly IE11 & Firefox) to access this website.

if user logged in to IE11 first and then logged into Firefox, and come backto IE11 and want to do any action then user should be redirect to Login page from IE11 browser. Basically users old session should be expired and should be on latest session always. How to achieve that in ASP.Net. Please suggest
Posted

1 solution

First, the sessions. The sessions for two browsers are unrelated and are supported separately. No, you cannot detect in browser that some session is started in another browser: generally, a browser "does not know" anything about a different browser and its connection. Just think about it: what if some other user connected and loaded some page; what's the difference?

But authentication, obviously, is not the same as the session, but it normally depends on sessions. You can persist the authentication status in, say, your database. Yes, when the session is ended, you should end the authenticated state for the user, but you are interested in handling of the different situation: the same user connected using a different browser. As I just tried to explain, it is no different from the situation when some other user has connected. What makes the difference is event when this "second" user tries to authenticate with the same credentials. As you have your persistent authentication state showing the "already authenticated" situation, you can prevent "redundant" authentication and deny the access. As this situation is 100% certain and reliably detected, this will really give you reasonable behavior, in contrast to your idea to "expire the session".

—SA
 
Share this answer
 

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