Andy M
Andy M

Reputation: 6065

Floating licenses in ASP.Net - releasing properly a license

I'm implementing a floating licenses module in my ASP.Net website (Framework 4).

So far, I've chose to assign a license to a user within my LoggedIn method and it works like a charm.

Now, I want to deal properly with the user's disconnection.

Is it correct to react to both the LoggedOut method and the Session_end ? It seems like dupplicating code to me...

What would be the best place(s) to handle a proper disconnection ?

Edit :
I plan on storing each user's license within a session variable.

Upvotes: 0

Views: 197

Answers (1)

kdrvn
kdrvn

Reputation: 1009

You could simply put your code in the Session_End & terminate the session when the user logs out.

To terminate the session use:

Session.Abandon();

http://msdn.microsoft.com/en-us/library/system.web.sessionstate.httpsessionstate.abandon(v=vs.100).aspx

You might also want to read this page regarding Session-State events: http://msdn.microsoft.com/en-us/library/ms178583(v=vs.100).aspx

The Session_OnEnd event is supported only when the session state Mode property is set to InProc, which is the default.

Upvotes: 2

Related Questions