Last post May 12, 2010 02:30 AM by frez
May 11, 2010 09:12 PM|faymy001|LINK
I am working on asp.net , I want to restrict a user to login in his acount from multiple
locations or machines.
If one user is already login , I want to restrict it and display message that you are already login somewhere.
May 11, 2010 10:44 PM|ammd|LINK
Setup a table to store a flag when the user logs in. Then on subsequent logisn check for that flag if its set to true and decide that user is unable to log in. Although in this case you will either have to force the user to log out and delete that flag,
or use an asp.net event like session_end and log them out when the session ends. Or you can store the machine name and keep them logged in on that machine. These are a few options.
May 11, 2010 11:15 PM|faymy001|LINK
Thanks for your reply.
If I store flag for a user in table when he login, and update flag when user logout.But what happens when user does not
logout and just close the webpage or computer shutdown,in that case that flag still remain true for that user.
If i use session_end event to update user flag , then where do I declare that event to fire.
May 12, 2010 02:30 AM|frez|LINK
A better solution is to logout the original session.
When the user logs in you create a guid as a 'session' identifier, you write this to the membership users comment field and store it in session state. Every time you request a page you check the identifier held in session state against the one held in the
memebership users comment field and log them out if it is not identical. This stops mnultiple logins by the same user but gets around the requirement for users to logout rather than just close their browser.