Last post Jan 21, 2011 09:01 AM by NikxGupta
Jan 11, 2011 04:35 AM|SuHlaing|LINK
I want to control the login user to access our system. I authenticated all of users by using my own way in project. and I want to limit the number of user to access the system cncurrently. It means , When we sell our project to customer as Licence software.
If user buy it for three users, we will allow three conurrent login user to access the system. We don't want to control the user creation but the server should control the concurrent login user count as per licence. After reading some article, I see there
are two main ways to control the no of users.
One way is to use the membership property in my project and then can count the number of online users by executing Membership.GetNumberOfUsersOnline Method.
If I use membership property, I think it is not ok at my project. I want to explain a bit about my project. Our system allow our customer to create their own users as they wish. So we don't want to control the user creation when they use our system. But
we want to control the total no of current login user as per our licence agreement. It means, If we made agreement for 3 user licence, the system must allow three concurrent users.I am not really sure whether I can use membership provider property to get
my system requirement or not. Any help / suggestion would be much appreciated.
I am still learning in Membership provider in asp.net.
Another way is to control the open session.
I implemented the following code in global.asax
void Application_Start(object sender, EventArgs e)
// Code that runs on application startup
Application["ActiveSession"] = 0;
void Session_Start(object sender, EventArgs e)
// Code that runs when a new session is started
Application["ActiveSession"] = (int)Application["ActiveSession"] + 1;
void Session_End(object sender, EventArgs e)
// Code that runs when a session ends.
Application["ActiveSession"] = (int)Application["ActiveSession"] - 1;
When I run the project, Session_Start method is fired but Session_End event is not fire when I use Ctrl+X , Alt+ F4 or click 'X" button on menu bar.
At my web.config, there is no configuration for session mode. Tt means session state is default ("InProc" session mode).
Can anyone help me with this?
Jan 21, 2011 09:01 AM|NikxGupta|LINK
Session_End only fires when session expires or Session.Abandon() is called declaretively
Set timeout propoerty in Session tag in web.config to 1 or call Session.Abandon() anywhere in your application to fire it