Posted on 2004-09-01
i have an asp.net application which will limit for an example 10 users to log in at 1 time ( to control network traffic purpose).
The 11th user who wana log on have to hold on until the 1 of the first 10 users log out, the 11th user then will be able to log on to the website.
So i need to detect number of active users who access my website.
This is my coding for this event:
Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the session is started
Application("UserCount") = Application("UserCount") + 1
Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the session ends
Application("UserCount") = Application("UserCount") - 1
In my logout page:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Is the session.RemoveAll() will trigger the session_end in global.asax so that it will minus the Application("UserCount") value?
What i have now is although i have logout will a proper way ( thats mean click on logout and trigger the session.removeall() ), but the session_end is depends on the timeout which is set in web.config.This mean the 11th user need to hold on for 5 minutes after 1 of the first 10 users log out.
Or any of you got any alternate way. Please help. Thanks.