I have a simple requirement of not allowing a user to log into multiple browsers at a time. Same browser is fine.
What is the simplest thing which can be done?
Technlogy : .net 4.0 and sql sever 2008 R2
See my advices below:
LastActivityDate
for each user. If you are using asp.net SqlMembershipProvider
- this field exists there, if you use another authentication mechanisms - probably you need to create it and update with each request of certain user.LoggedIn
for each user. This field will be set to true when user does login. If you are using asp.net SqlMembershipProvider
you can store its value in Comment
field.LoggedIn
field to false
. Use window.onbeforeunload
javascript event for that.LoggedIn
field for the user, if it is false - you simply process the operation. If not - you should check LastActivityDate
value, and if it older than a timeout you will define (lets say 3 minutes) process the operation. If not - reject it and show error message. This additinal check is required because we cannot guarantee that window.onbeforeunload
is always executed.LastActivityDate
. This script should be defined on each page which is accessible for logged in user.I hope the approach is clear.