Author: hunzonian | Posted on: 6/26/2008 3:58:54 PM | Views : 262

 Eventhough users are logged in and able to browse, after a few minutes the counter shows zero (0). ANyone know why this is. Below is the code I use to display the counter:
 // get number of registred users and assign it to global variable
    private MembershipUserCollection allRegisteredUsers = Membership.GetAllUsers();

    protected void Page_Load(object sender, EventArgs e)
    {
        // get the number of registered and online users
        // and bind them to the labels on the page
        lblOnlineUsers.Text = Membership.GetNumberOfUsersOnline().ToString();
        lblTotalUsers.Text = allRegisteredUsers.Count.ToString();
    }

...

Go to the complete details ...