I had a serious problem in my project (a web application built in ASP.NET 2.0), which is described below.
Say I gave userid "singh_nirajan" and the user said "User1" by logging in using this user ID. Now my requirement is that every time another user allows me to say that the user "User2" is trying to log in using the same (singh_nirajan) userid, he will show a message that "singh_nirajan is already logged in."
To implement the same thing, I just update the flag in the database. Similarly, we update the flag in the database every time a user logs off the system properly. And we also looked at several scenarios when the user will not log out correctly as follows.
- Close browser by pressing (X) close
- Session Timeout
- On error
But for some reason, the user suddenly crashes due to a network failure, power failure, or any such reason. I cannot update the flag in the database, so the user cannot log in using the same user ID until we manually update this flag.
Reason for implementation above:
Once a user opened several browsers and launched a heavy processing task in different browsers, in many cases they share their user ID and password, which someday invite a concurrency problem. To limit this, we need to implement a single login instance.
Can anyone suggest me any other approach to implementing the above.
Thanks in advance.
source share