I am facing a serious problem in my project (a web application built in ASP.NET 2.0) explained below.
Let say I have given userid “singh_nirajan” and A user say “User1” logged into the system using this userid. Now my requirement is whenever other user let say User “User2” try to log in to the system using same (singh_nirajan) userid, it will show a message that “singh_nirajan already logged in”.
In order to implement the same, I just update a flag in database. Similarly, we update the flag in database whenever user logout properly. And we have also handled few scenarios when user will not properly log out as follows.
- Browser close by clicking (X) close
- Session Timeout
- On Error
But somehow user gets logged out abruptly because of network failure, power failure or any such reason. I am not able to update the flag in database that is why user is not able to log in using same userid until and unless we update that flag manually.
Reason for above implementation:
Sometime a user open multiple browser and started heavy processing task in different browser, many of times they share their user id and password which sometime invite concurrency problem. In order to restrict this, we need to implement the single instance login.
Can any one suggest me any other approach to implement the above.
Thanks in advance.