0

When i login with user A login credentials in one web browser(chrome) and run my application,and then i login with same user in another browser(Firefox). How to automatically force previous web browser(Chrome) session expires using form authentication in ASP.NET?

Thanks in Advance.

Thang Pham
  • 611
  • 5
  • 12
Sekhar MS
  • 1
  • 1
  • 1
  • 6
  • You may want to have a look on this: https://stackoverflow.com/questions/2922502/limit-only-one-session-per-user-in-asp-net – Thang Pham Jul 17 '17 at 07:26
  • Thank you zzT ,for your quick response.i hope it will useful to my problem.Thank you. – Sekhar MS Jul 17 '17 at 07:59
  • 2
    Possible duplicate of [Limit only one session per user in ASP.NET](https://stackoverflow.com/questions/2922502/limit-only-one-session-per-user-in-asp-net) – Salih Karagoz Jul 17 '17 at 09:13

2 Answers2

0

It doesn't matter if you logged in with same user . If you use different browser , that means IIS server/any server will generate a different token for your session. Suppose if you login in facebook with chrome. If you close chrome and again start and hit facebook.com you see it will automatically saved your credential. But if you login with firefox or any browser it will not save, you have to start it from the beginning. Because its a relation of server-client model. Every time you log into any website , server will generate a token for the client browser and browser saves it as cookies. You better read this

  1. Server-Client Session
  2. Client-Server Runtime
Pritom
  • 57
  • 1
  • 12
  • Thank you for your quick response. Here what I'm asking you to suggest me is , when user login into a site with his login details and continuing his work. Then Someone Login with same login credentials. In this way the first login has to expire. and second login is going to continue his work. Is there any way to check this above scenario.(i.e logout the first user login, when the second user logins with same login details and display a message saying someone login with same login credentials. so Your session is expired. Please login again to continue.) – Sekhar MS Jul 17 '17 at 07:48
0

I don't think this is possible to do it built-in. Each time someone log, give them a guid and store that guid in the database. On each page load, check if the guid is the same. When someone log again, the guid would change and the first one would be log off.

the_lotus
  • 12,668
  • 3
  • 36
  • 53
  • Yup Thank you for your response,i don't know it is correct or not , Here what I'm asking you to suggest me is , when user login into a site with his login credentials and continuing his work. Then Someone Login with same login credentials. In this way the first login has to expire. and second login is going to continue his work. Is there any way to check this above scenario.,is there any solution is there . – Sekhar MS Jul 17 '17 at 14:38
  • If you log in IE, your app will give you a key "asd". Then you log in chrome, your app give a new key "qwe". When IE query a new page, it will compare it's current key "asd" with the new key "qwe" and will see it's different and log off. – the_lotus Jul 17 '17 at 14:52
  • Oh okay ,Thank you for your valuable clarification,Thank you for your response lotus. – Sekhar MS Jul 17 '17 at 14:58