Click to See Complete Forum and Search --> : get online user in membership class


mayanksrmcem
10-14-2008, 01:42 AM
hi all,
i am using membership class in my website.
i want to generate a list of all online user of the site.

there are some methods like getAllUsers() and getNumberOfOnlineUsers(),
but there is not any function like "GetAllOnlineUser()"

how can i done this type of thing...

please help me.
thanx
mayanksrmcem

mayanksrmcem
10-24-2008, 11:18 PM
hello friends,
i have solved my problem to find all online user.

As i already told to you that i'm using getAllUsers() method which returns a collection of all user.
there is a property "isOnLine" by which we can check that a user is online or not...

now, if we pass this collection to in a foreach loop and with in loop we check that members are online or not, we can find all online users...


An example of code is as followes...........


MembershipUserCollection allUsers = Membership.GetAllUsers(this.PageIndex, this.PageSize, out totalRecords);
MembershipUserCollection filteredUsers = new MembershipUserCollection();

bool isOnline = true;
foreach (MembershipUser user in allUsers)
{
// if user is currently online, add to gridview list
if (user.IsOnline == isOnline)
{
filteredUsers.Add(user);
}
}