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 wanna 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 numbers 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")+ = 1
Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the session ends
Application("UserCount") -= 1
In my logout page:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
The session.abandon will event session_end immediately if i logout with a proper way by clicking logout button and this will trigger application("usercount") -=1. However, Application("Usercount") -=1 will be trigger again after 5 minus which is the timeout set in web config for the session. So for example two users log in and i will get -2 for my 'application("usercount")' after all the two users log out.
May i know why this happen? Or if there is any alternate way to get the same output? Please help.
Besides that, is there a way to detect double usernames log on, which mean the same username is log on using the different machine on the same time?