Display the Total Number of Users Connected to Your Site

Category:
ASP, HTML and XML
Type:
Snippets
Difficulty:
Beginning
Author:
Intelligent Solutions Inc.

Version Compatibility: ASP

More information:
This code uses the Session_OnStart and Session_OnEnd subs within global.asa to count the total number of users currently connected to your site. For this reason, it won't provide an exact count. For instance, if the session timeout value in IIS is set to 20 minutes (the default), and someone visits the page and leaves immediately for another web site, that person will still be counted as a visitor 19 minutes later (unless he/she closes the browser beforehand). Nonetheless, it provides a reasonable approximation. If you really need to get a more exact count, you can lower the session timeout value within IIS.

Instructions: Copy the declarations and code below and paste directly into your VB project.

Declarations:

Code: