asp.net - No Multiple Login on Same machine but same browser allowed -
i have simple requirement of not allowing user log multiple browsers @ time. same browser fine.
what simplest thing can done?
technlogy : .net 4.0 , sql sever 2008 r2
see advices below:
- store
lastactivitydate
each user. if using asp.netsqlmembershipprovider
- field exists there, if use authentication mechanisms - need create , update each request of user. - add additional boolean field
loggedin
each user. field set true when user login. if using asp.netsqlmembershipprovider
can store value incomment
field. - when user closes browser send request server 'logout' user, means set
loggedin
fieldfalse
. usewindow.onbeforeunload
javascript event that. - on user login should check
loggedin
field user, if false - process operation. if not - should checklastactivitydate
value, , if older timeout define (lets 3 minutes) process operation. if not - reject , show error message. additinal check required because cannot guaranteewindow.onbeforeunload
executed. - the final step javascript consequentially calls server action in timeout updates
lastactivitydate
. script should defined on each page accessible logged in user.
i hope approach clear.