1. In this page, set a variable LastVisitTime to store the last time the user visiting this page.
2. Use AJAX Timer, and every interval you can update database about the LastVisitTime of this user.
protected void Timer1_Tick(object sender, EventArgs e)
{
sql.update(update membertable set lastvisittime='" +DateTime.Now+ "' where username='" +User.Name+ "'");
}
3. Set the variable offVisitTime to check if this user is visiting the page.
DateTime lastvisit = Convert.ToDateTime(sql.select("select lastvisittime from membertable where username='" +User.Name+ "'"));
TimeSpan tSpanDifferent =DateTime.Now-lastvisit;
If(tSpanDifferent>SpanSpace)
For example, you can set Timer Interval as 2 minutes and set SpanSpace as 5 minutes.
4. After that, you can get the number of visiting users and who is visiting the page via looping.
[edit] code tags added [/edit]