On an ASP.NET site, what are some techniques that could be used to track how many users are logged in to the site at any given point in time?
So for example, I could
This sort of depends on your site. If your using the ASP.Net Membership Providers there is a method: Membership.GetNumberOfUsersOnline() which can tell you how many logged in users there are. I believe there are also performance counters. The notion of a logged in user is a user who did something within the last x minutes where x is configurable.
You could also use performance counters to track incoming requests if you want to get a sense of how much activity there is.
Just so you know the SQL ASP Membership providers implements this by recording an activity date on a field in the DB. It when just queries it for all activity within x minutes.
I added a client side polling function which hits our server every 2 minutes, so while a user is sitting on the page I know they are there even if there is no activity. This also let me force the user out of the system, provides a method deliver other system messages. Kind of nice.