Resources
| Current Active Users on Your Site |
| Posted by : Amit Agarwal |
Total Hits : 12918 |
Did you know you could track the number of Current Users on your site with a simple addition to your Global.asa , the code below explains how you can do it in detail..
|
|
|
Get the Source Code.
' This is your global.asa file
<SCRIPT LANGUAGE=VBScript RUNAT=Server>
Sub Application_OnStart
'CurrentUsers Application variable with 0 value when the Server Starts Application("CurrentUsers") = 0
End Sub
'When a new user comes to your site a new session is started Sub Session_OnStart
'Add 1 to the value of CurrentUsers Application Variable when a new session is started Application.lock Application("CurrentUsers") = Application("CurrentUsers") + 1 Application.unlock
End Sub
Sub Session_OnEnd
'Reduce 1 from the value of CurrentUsers Application Variable when a session ends Application.lock Application("CurrentUsers") = Application("CurrentUsers") - 1 Application.unlock
End Sub
</SCRIPT>
'You can now use the above CurrentUsers Application Variable anywhere in your ASP pages to show your current users
Response.write Application("CurrentUsers") |
|
|
|
 |
|
 |