0

I am working on one web application in which i want to make sure that website allow only one login per user at a time on one browser only.It means if a user is logged in from chrome than that user can not log in from internet explorer or any other browser from the same id at a time. If he tries to log in from another browser than a message should be displayed saying he is already logged in from a browser and if he wants to continue in another browser than he should get automatically logout from the first one.

Please suggest code for this in asp.net.

rkhan
  • 1
  • 1
  • 3
    Possible duplicate of [Allow only a single login session per user](http://stackoverflow.com/questions/25359851/allow-only-a-single-login-session-per-user) – Anoop H.N Feb 10 '17 at 07:28

1 Answers1

-1

You need to have status column in your table and make its datatype boolean, so When a user logged in update that status into true, and when a user logged out then update status into false. Whenever a user try to login then you need to check status for that user, if status already true, show a message that a user already logged in, if false, then allow for login.

Saif
  • 2,611
  • 3
  • 17
  • 37
  • Thanks but i want that If user tries to log in from another browser than a message should be displayed saying he is already logged in from a browser and if he wants to continue in another browser than he should get automatically logout from the first one. – rkhan Feb 10 '17 at 10:03
  • yeah, this should work for all browsers. When a user try to login from other browser or other device and he already logged in, just show a message and this message must have 2 buttons, a button for example `log out from other device` and a button for `cancel`. If a user click `log out from other device` then logout from first one by updating status column into false... – Saif Feb 10 '17 at 10:23
  • I gave you the idea already and it is the answer for your question..if you have need something else then please make it as a new question – Saif Feb 10 '17 at 10:59
  • Saif, your answer is poor. and gives no information. – BrownPony Jun 25 '21 at 16:58