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

I have requirement where if two users logged in with same userid and password from two different machines at the same time then it should not allow second user to get into the system. It means only one user can login at one time from one machine.

Thanks in advance.
Posted
Comments
Sergey Alexandrovich Kryukov 6-Mar-13 0:40am    
Seems obvious, just a part of authentication, with one more result. What's the problem? What did you try? Do you have any authentication at all? If so, what you need is nearly that same, isn't it?
—SA
sunil mali 6-Mar-13 1:43am    
I havn't tried yet, i need logic to build this kind of application. where simultaneous users cannot login at the same time. I am not using in build asp.net authentication mechanism,i am planning to do it through stored procedure still i will share my login code with you. which doesn;t have simultaneous users solution.

You can do this may managing a table for Loggedin Users....with a column called loggedInStatus(1/0)
.. at the time of login check if loggedInStatus is true then..do not logged in user..

However you could also use the System.Web.Caching.Cache object to track a users current session as well. If finding the info in the cache object fails fall back to reading it from the DB then place that info in the cache for the benefit of subsequent requests.


You Can Also check this thread...

http://stackoverflow.com/questions/1042892/how-to-prevent-simultaneous-login-with-same-user-on-different-pcs[^]
 
Share this answer
 
Save the current user in session or in the memory,when any user login,check the state of the user.
 
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