KConner32
asked on
Limit MVC Login to 3 concurrent logins
Is there a good way to allow a MVC app to have a limited number of concurrent logins. I know how to limit it to one concurrent login, but is is possible to limit it to 3 for instance.
ASKER
I mean 3 people may simultaneously login under the same username and password. To make it a single login, I just fire the UpdateSecurityStampAsync method on the user manager which will invalidate any user already logged in using those credentials. so user A logs in as user1@user.com, then when someone else logs in using user1@user.com the first user is logged off.
The client now wants to allow a "family" membership that will allow some identities to have upto three logins at the same time (think netflix). I thought about keeping a counter and adding one on session start and deducting one on session end, but that only works well if the user logs out, most just close their browser, so then I am likely to have orphaned session counts associated with the login, which I assume will time out in 20 minutes. Is there some better way?
The client now wants to allow a "family" membership that will allow some identities to have upto three logins at the same time (think netflix). I thought about keeping a counter and adding one on session start and deducting one on session end, but that only works well if the user logs out, most just close their browser, so then I am likely to have orphaned session counts associated with the login, which I assume will time out in 20 minutes. Is there some better way?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
When you say 3 concurrent logins do you mean to keep the total number of users at 3 at any given point of time OR you mean with a single username / password combo up to 3 users can connect concurrently?
Both scenarios will involve modifying global.asax.cs and adding Session_Start, Session_End method and your authentication controller.
Regards,
Chinmay.