0

I have a request from my customer: 'Prevent multi user with same account id login at the same time'. I have implemented like this: create userflag in account table. When user login, flag is active (1). The other can't login when flag was 1. When user log out, the flag is deactive(0).

But I have trouble when user doesn't logout. If he directly close browser, the flag still active. Could you give me some advised to fix this problem ?

Besides, in asp.net core, I can't find something like SessionEnd event, because I want whenever sessionend, I'll return flag of user in DB, but I can't find it. Please give me some advised. Thanks

  • 2
    Possible duplicate of [How to sign out other user in ASP.NET Core Identity](https://stackoverflow.com/questions/41629691/how-to-sign-out-other-user-in-asp-net-core-identity) – CodeCaster Jul 20 '19 at 05:18
  • Do it when logging in, see duplicate. – CodeCaster Jul 20 '19 at 05:19
  • You may need to rethink your issue, how did you decide whether the user is logout? If a user signin and then did not operate anything, keep the windows open all the time, will he be treated as deactive? For web app, the request is stateless. You could not decide the client side status from server side. You may try signalr. – Edward Jul 22 '19 at 09:42

0 Answers0