Home Ask Login Register

Developers Planet

Your answer is one click away!

BendEg February 2016

Technique for user license implementation in asp.net mvc

Currently i'm searching for a technique to create a named user license system with asp.net mvc. For example a customer has bought 10 user licenses, it should only be possible, to log in 10 times parallel.

The problem I'm struggeling with, is the fact that there is no permanent connection in web technologies. (Between client and server, besides using web sockets or some similar things).

Or is there a well known and good alternative?

Thank you very much!


Tgrelka February 2016

A possible solution (which may or may not be the right one for you), is to store the amount of sessions a user currently has and is allowed to have in two columns in your database.

Let's say you have the functions login(username, password) and logout(username), or something similar. Then, you need two new columns in your database, one storing the maximum amount of sessions a user can have, e.g. maxSessions , the other one containing the current count of sessions a user has, e.g. curSessions.

Now you can check with every call of login(username, password) if a user has reached the maximum of allowed sessions, and deny his access to your service. If he hasn't, add 1 to curSessions, then run your other login code. If logout(username) gets called, remove 1 from curSessions, and run your logout code.

If I understood your question the right way, this is what you were looking for.

Post Status

Asked in February 2016
Viewed 1,498 times
Voted 10
Answered 1 times


Leave an answer

Quote of the day: live life