Hello,
I have an mvc web application. Now i have a requirement to not allow the same/different user to login from same browser when a user is already logged in.
Please help to find a solution for this.
Hello,
I have an mvc web application. Now i have a requirement to not allow the same/different user to login from same browser when a user is already logged in.
Please help to find a solution for this.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Tahir AnsariPosted Sep 2, 2024, 4:43 PM
You can store active session
On User Login
Check Existing Sessions:
Query the ActiveSessions table to see if there’s an active session for the user with the same BrowserInfo.
Invalidate Old Session:
If an existing session is found, remove it.
Create New Session:
Insert a new record with the SessionId, UserId, and BrowserInfo