Hi,
in the Global.asax file, you have method called session_start and session_end.
at the time of session_start you can increase the hit count and in the session_end decrease the hit count.
like below:
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
Application("Sessions") = 0
End Sub
Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
Application.Lock()
Application("Sessions") = CType(Application("Sessions"), Integer) + 1
Application.UnLock()
End Sub
Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
Application.Lock()
Application("Sessions") = CType(Application("Sessions"), Integer) - 1
Application.UnLock()
End Sub
QUOTE(robins @ 29 Jun, 2009 - 09:26 PM)

Hi...
This is my first post....
I`m beginner & working with Visual Studio 2008 & C#.
I`m developing a web site. I want to track no of users currently logged in to the site.I`ve managed it by usisng session.
It is working fine if a user loged out by clicking the 'Sign Out' button.
But if the user closes the browser or uses Task manager to close the bowser, then the count is not correct.
How can I handle it accurately..?
Any help would be greatly appreciated.
Regards
Robins[font=Times New Roman]