Click here to Skip to main content
15,907,874 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi All,

I have a simple requirement of not allowing a user to log into multiple browsers at a time. Same browser is fine.

What is the simplest thing which can be done?
Posted

1 solution

That's surprisingly complicated: since different browsers do not share cookies (i.e. Chrome cookies are not used by IE and vice versa) it has to be done at the server, and since different browsers will also have different sessions, it has to be pretty much DB related.

The only way I can think of off the top of my head is to store the client IP and session ID in your DB when he logs in, and check for live session using the same IP when he tries again.

There is code here that will retrieve all active sessions: http://stackoverflow.com/questions/1470334/list-all-active-asp-net-sessions[^], you can then check a cookie to see if this is the same browser or not.
 
Share this answer
 
Comments
angelvarun 25-Apr-13 7:39am    
Thanks Griff. But it seems that its a long process and checks...

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