Who's Online Application
page 1 of 7
Published: 23 Sep 2003
Unedited - Community Contributed
Article explaing a sample application that keeps track of every user that is online on a website. Source code available in C# and VB.Net.
by Alex Campbell
Average Rating: 
Views (Total / Last 10 Days): 43183/ 59



I get a couple of emails a day asking how to make a page that shows which users are online at a particular web site.  This article is more in response to those emails than to a genuine engineering need to solve this problem (in fact, here are a bunch of reasons why this is a bad idea).

If you are just looking to download the code and get it running, click here to be taken to the source download page.

View Entire Article

User Comments

Title: Session.SessionID.ToString());   
Name: Spyros
Date: 2011-10-26 3:19:28 PM
Seems not to work on asp.net 3.5 .
In global asa Session.SessionID.ToString()); is null.
Any idea ?
Title: Download links are broken   
Name: Linu
Date: 2009-12-21 1:33:33 AM
The download link is broken, please fix it!
Title: I think it is possible to overcome the database hit issue   
Name: Yasser
Date: 2009-11-16 12:56:51 PM
You're right, there is no point in doing a trip to the database on every request. As information about active users is useless once their session expires, I think it is a silly idea to store this information in the database (unless some kind of user online history needs to be stored). One alternative is to keep all logged in users in memory and do an in-memory lookup rather than a database lookup. The cleanup tasks are also performed on the online users collection object in memory.
Title: Bad idea ?!!! are you kidding me   
Name: Vex
Date: 2008-11-09 3:51:31 PM
When is the last time you checked out myspace.com and facebook.com . People want to know which ones of their friends are online and they want to chat to them. that's one of the main interactive features of any social network website.
Title: Why this could be useful   
Name: Sharky
Date: 2008-01-19 11:31:05 PM
one use is to see who is online to engage in an online chat. I think MySpace does this. There is a built in ASP.Net 2.0 function that shows you the number of users online but no built in query to show you who they are.
Title: Code names mixed   
Name: Frank
Date: 2007-09-17 8:16:37 AM
Just an FYI. The links for the zip files are backwards. CS is under VB and vice versa.

Great info tho, just what my customer wants. Same as David Allen said, small site (100 users tops) and the admin's want to be able to see who's logging in as well as who's sharing their logins.

I had no idea how this would be done and you've knocked off a lot of time figuring it out on my own.

Title: Why this is a good idea   
Name: David Allen
Date: 2005-08-02 10:43:21 PM
Your concerns about performance impact are legitimate; I share them.
But in enterprise applications (not high-volume, public applications), where users are known and from a limited pool of users, and you support them, then this can be very handy.
davidkallen at yahoo dot com (email munged to prevent spam)

Community Advice: ASP | SQL | XML | Regular Expressions | Windows

©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-06-14 3:11:01 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search