Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Determining an 'active' user count of an ASP.NET site

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 produce a report showing something like this:

        10:00am  11:00am  12:00pm  1:00pm  2:00pm ....
 3/25      25      32       45      40      37
 3/26      31      38       50      57      40
 3/27      28      37       46      35      20
 etc. 

EDIT: No, we're not using ASP.NET Membership provider, it uses a home-grown/hacky session based method of determining whether or not a user is in 'logged in' status.

like image 929
Tim Cavanaugh Avatar asked Mar 26 '09 14:03

Tim Cavanaugh


People also ask

What is tracking in asp net?

ASP.NET tracing enables you to follow a page's execution path, display diagnostic information at run time, and debug your application. ASP.NET tracing can be integrated with system-level tracing to provide multiple levels of tracing output in distributed and multi-tier applications.


1 Answers

Does the website log the user in? If it does, then you can update a "Last Visit" field in the user table every time they request a new page, and then every hour, just do a SQL query that grabs everybody who has a "Last Visit" timestamp within the last 15 minutes or so (assumed to currently be on the site).

If you're not having people log in, you could just as easily do it by IP address instead of username. With this method, though, you may run into some proxy issues (ie multiple users from the same corporate network may all come from a single IP address, so they only count as one user in your totals), but that should be minimal.

like image 200
SqlRyan Avatar answered Sep 30 '22 21:09

SqlRyan