Single Instance Login Implementation
<p>I am facing a serious problem in my project (a web application built in ASP.NET 2.0) explained below.</p>

<p>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”.</p>

<p>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.</p>

<ol>
<li>Browser close by clicking (X) close</li>
<li>Session Timeout</li>
<li>On Error</li>
</ol>

<p>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.</p>

<p><strong>Reason for above implementation:</strong></p>

<p>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.</p>

<p>Can any one suggest me any other approach to implement the above.</p>

<p>Thanks in advance. </p>
