473,327 Members | 1,936 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

What's the deal with Membership.GetNumberOfUsersOnline?

Hi there,

Membership.GetNumberOfUsersOnline() works great the first time, then
jumps up to the number of users registered in the system.

I have tried enumerating through each user individually and checking
IsOnline which done likewise, first result was 4, then 22 every time after
that and it's only be debugging locally using VS.

Either I'm doing something seriously wrong or this function is a
complete joke. I'm opting for the latter personally....

Any input on this would be greatly appreciated.

Nick.
Jul 30 '08 #1
8 3716
Hi Nick,

From your description, you're encountering some problem when using
Membership.GetNumberOfUsersOnline API, correct?

According to your scenario, the number changed when you call it second
time. Based on my research, the GetNumberOfUsersOnline will be affected
when some of the following methods are called(from the MSDN document)

==================
The last-activity date/time stamp is updated to the current date and time
when user credentials are validated by way of the ValidateUser or
UpdateUser method or when a call to a GetUser overload that takes no
parameters or one that uses the userIsOnline parameter to specify that the
date/time stamp should be updated.
============

#Membership..::.GetNumberOfUsersOnline Method
http://msdn.microsoft.com/en-us/libr...mbership.getnu
mberofusersonline.aspx

Therefore, I wonder whehter any of the methods are called so that all the
users become activated before you call the GetNumberOfUsersOnline method
second time. You can also directly validate the database table's
"lastactiviated" field to verify the behavior.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
>From: "Nick" <a@a.com>
Subject: What's the deal with Membership.GetNumberOfUsersOnline?
Date: Wed, 30 Jul 2008 13:58:18 +0100
>
Hi there,

Membership.GetNumberOfUsersOnline() works great the first time, then
jumps up to the number of users registered in the system.

I have tried enumerating through each user individually and checking
IsOnline which done likewise, first result was 4, then 22 every time after
that and it's only be debugging locally using VS.

Either I'm doing something seriously wrong or this function is a
complete joke. I'm opting for the latter personally....

Any input on this would be greatly appreciated.

Nick.
Jul 31 '08 #2
Hi Nick,

Any further quesiton on this issue?

Sincerely,

Steven Cheng
Microsoft MSDN Online Support Lead

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>From: st*****@online.microsoft.com (Steven Cheng [MSFT])
Organization: Microsoft
Date: Thu, 31 Jul 2008 02:24:17 GMT
Subject: RE: What's the deal with Membership.GetNumberOfUsersOnline?
>
Hi Nick,

From your description, you're encountering some problem when using
Membership.GetNumberOfUsersOnline API, correct?

According to your scenario, the number changed when you call it second
time. Based on my research, the GetNumberOfUsersOnline will be affected
when some of the following methods are called(from the MSDN document)

==================
The last-activity date/time stamp is updated to the current date and time
when user credentials are validated by way of the ValidateUser or
UpdateUser method or when a call to a GetUser overload that takes no
parameters or one that uses the userIsOnline parameter to specify that the
date/time stamp should be updated.
============

#Membership..::.GetNumberOfUsersOnline Method
http://msdn.microsoft.com/en-us/libr...embership.getn
u
>mberofusersonline.aspx

Therefore, I wonder whehter any of the methods are called so that all the
users become activated before you call the GetNumberOfUsersOnline method
second time. You can also directly validate the database table's
"lastactiviated" field to verify the behavior.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

p
Aug 4 '08 #3
Hi Steven,

Sorry for the delayed reply, I've got several threads running at the
same time trying to do too much at once LOL!

The users are only being enumerated in one point and that's the
additional function i've made to count the number of users currently online,

---

int pIntCurCount = 0;
MembershipUserCollection pMUCUsers = Membership.GetAllUsers();
foreach (MembershipUser pMUrUser in pMUCUsers)
{
pIntCurCount += (pMUrUser.IsOnline ? 1 : 0);
}
lblUsersOnline.Text = String.Format("Users Online : {0} - ",
pIntCurCount.ToString());

---

This consistently produces the correct number the first time it is run,
then returns the total number of users the second time round. So it seems
that GetAllUsers must be modifying the flag as you suggest, but then that
just raises the question of how this could possibly be achieved other than
enumerating the database manually which imo, is nasty and shouldn't need to
be done.

So surely GetNumberOfUsersOnline is buggy? It doesn't produce a
consistently correct value, so must be surely?

More to the point, why is the users last logged in date changed at all
during any of these calls? Why not leave it down to the user to update the
value via a manual invocation of an update method. If this is the correct
behaviour, it is pretty poor unfortunately.

Nick.

"Steven Cheng [MSFT]" <st*****@online.microsoft.comwrote in message
news:j2**************@TK2MSFTNGHUB02.phx.gbl...
Hi Nick,

From your description, you're encountering some problem when using
Membership.GetNumberOfUsersOnline API, correct?

According to your scenario, the number changed when you call it second
time. Based on my research, the GetNumberOfUsersOnline will be affected
when some of the following methods are called(from the MSDN document)

==================
The last-activity date/time stamp is updated to the current date and time
when user credentials are validated by way of the ValidateUser or
UpdateUser method or when a call to a GetUser overload that takes no
parameters or one that uses the userIsOnline parameter to specify that the
date/time stamp should be updated.
============

#Membership..::.GetNumberOfUsersOnline Method
http://msdn.microsoft.com/en-us/libr...mbership.getnu
mberofusersonline.aspx

Therefore, I wonder whehter any of the methods are called so that all the
users become activated before you call the GetNumberOfUsersOnline method
second time. You can also directly validate the database table's
"lastactiviated" field to verify the behavior.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no
rights.

--------------------
>>From: "Nick" <a@a.com>
Subject: What's the deal with Membership.GetNumberOfUsersOnline?
Date: Wed, 30 Jul 2008 13:58:18 +0100
>>
Hi there,

Membership.GetNumberOfUsersOnline() works great the first time, then
jumps up to the number of users registered in the system.

I have tried enumerating through each user individually and checking
IsOnline which done likewise, first result was 4, then 22 every time after
that and it's only be debugging locally using VS.

Either I'm doing something seriously wrong or this function is a
complete joke. I'm opting for the latter personally....

Any input on this would be greatly appreciated.

Nick.

Aug 6 '08 #4
Hi Nick,

Per the document, the method call on "MembershipUser.IsOnline" may update
its online status. Therefore, I suggest you try calling
"Membership.GetNumberOfuserOnline" several times without accessing each
user's IsOnline property(remove the foreach loop). I think it will make the
"Membership.GetNumberOfuserOnline" call return the consistent result.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>From: "Nick" <a@a.com>
References: <#Q**************@TK2MSFTNGP05.phx.gbl>
<j2**************@TK2MSFTNGHUB02.phx.gbl>
>Subject: Re: What's the deal with Membership.GetNumberOfUsersOnline?
Date: Wed, 6 Aug 2008 13:40:40 +0100
>
Hi Steven,

Sorry for the delayed reply, I've got several threads running at the
same time trying to do too much at once LOL!

The users are only being enumerated in one point and that's the
additional function i've made to count the number of users currently
online,
>
---

int pIntCurCount = 0;
MembershipUserCollection pMUCUsers = Membership.GetAllUsers();
foreach (MembershipUser pMUrUser in pMUCUsers)
{
pIntCurCount += (pMUrUser.IsOnline ? 1 : 0);
}
lblUsersOnline.Text = String.Format("Users Online : {0} - ",
pIntCurCount.ToString());

---

This consistently produces the correct number the first time it is
run,
>then returns the total number of users the second time round. So it seems
that GetAllUsers must be modifying the flag as you suggest, but then that
just raises the question of how this could possibly be achieved other than
enumerating the database manually which imo, is nasty and shouldn't need
to
>be done.

So surely GetNumberOfUsersOnline is buggy? It doesn't produce a
consistently correct value, so must be surely?

More to the point, why is the users last logged in date changed at all
during any of these calls? Why not leave it down to the user to update
the
>value via a manual invocation of an update method. If this is the correct
behaviour, it is pretty poor unfortunately.

Nick.

"Steven Cheng [MSFT]" <st*****@online.microsoft.comwrote in message
news:j2**************@TK2MSFTNGHUB02.phx.gbl...
>Hi Nick,

From your description, you're encountering some problem when using
Membership.GetNumberOfUsersOnline API, correct?

According to your scenario, the number changed when you call it second
time. Based on my research, the GetNumberOfUsersOnline will be affected
when some of the following methods are called(from the MSDN document)

==================
The last-activity date/time stamp is updated to the current date and time
when user credentials are validated by way of the ValidateUser or
UpdateUser method or when a call to a GetUser overload that takes no
parameters or one that uses the userIsOnline parameter to specify that
the
>date/time stamp should be updated.
============

#Membership..::.GetNumberOfUsersOnline Method
http://msdn.microsoft.com/en-us/libr...mbership.getnu
>mberofusersonline.aspx

Therefore, I wonder whehter any of the methods are called so that all the
users become activated before you call the GetNumberOfUsersOnline method
second time. You can also directly validate the database table's
"lastactiviated" field to verify the behavior.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you.
Please
>feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

================================================= =
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
>ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent
issues
>where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each
follow
>up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
================================================= =
This posting is provided "AS IS" with no warranties, and confers no
rights.

--------------------
>>>From: "Nick" <a@a.com>
Subject: What's the deal with Membership.GetNumberOfUsersOnline?
Date: Wed, 30 Jul 2008 13:58:18 +0100
>>>
Hi there,

Membership.GetNumberOfUsersOnline() works great the first time, then
jumps up to the number of users registered in the system.

I have tried enumerating through each user individually and checking
IsOnline which done likewise, first result was 4, then 22 every time
after
>>>that and it's only be debugging locally using VS.

Either I'm doing something seriously wrong or this function is a
complete joke. I'm opting for the latter personally....

Any input on this would be greatly appreciated.

Nick.


Aug 7 '08 #5
Hi Steven

No it won't you, have completely misunderstood. I wrote that method as
an alternative to GetNumberOfUsersOnline, neither of which produce
consistent results.

In fact, that code sample doesn't even have a call to
GetNumberOfUsersOnline in it.

Nick.

"Steven Cheng [MSFT]" <st*****@online.microsoft.comwrote in message
news:$8******************@TK2MSFTNGHUB02.phx.gbl.. .
Hi Nick,

Per the document, the method call on "MembershipUser.IsOnline" may update
its online status. Therefore, I suggest you try calling
"Membership.GetNumberOfuserOnline" several times without accessing each
user's IsOnline property(remove the foreach loop). I think it will make
the
"Membership.GetNumberOfuserOnline" call return the consistent result.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

==================================================
This posting is provided "AS IS" with no warranties, and confers no
rights.
--------------------
>>From: "Nick" <a@a.com>
References: <#Q**************@TK2MSFTNGP05.phx.gbl>
<j2**************@TK2MSFTNGHUB02.phx.gbl>
>>Subject: Re: What's the deal with Membership.GetNumberOfUsersOnline?
Date: Wed, 6 Aug 2008 13:40:40 +0100
>>
Hi Steven,

Sorry for the delayed reply, I've got several threads running at the
same time trying to do too much at once LOL!

The users are only being enumerated in one point and that's the
additional function i've made to count the number of users currently
online,
>>
---

int pIntCurCount = 0;
MembershipUserCollection pMUCUsers = Membership.GetAllUsers();
foreach (MembershipUser pMUrUser in pMUCUsers)
{
pIntCurCount += (pMUrUser.IsOnline ? 1 : 0);
}
lblUsersOnline.Text = String.Format("Users Online : {0} - ",
pIntCurCount.ToString());

---

This consistently produces the correct number the first time it is
run,
>>then returns the total number of users the second time round. So it seems
that GetAllUsers must be modifying the flag as you suggest, but then that
just raises the question of how this could possibly be achieved other than
enumerating the database manually which imo, is nasty and shouldn't need
to
>>be done.

So surely GetNumberOfUsersOnline is buggy? It doesn't produce a
consistently correct value, so must be surely?

More to the point, why is the users last logged in date changed at all
during any of these calls? Why not leave it down to the user to update
the
>>value via a manual invocation of an update method. If this is the correct
behaviour, it is pretty poor unfortunately.

Nick.

"Steven Cheng [MSFT]" <st*****@online.microsoft.comwrote in message
news:j2**************@TK2MSFTNGHUB02.phx.gbl.. .
>>Hi Nick,

From your description, you're encountering some problem when using
Membership.GetNumberOfUsersOnline API, correct?

According to your scenario, the number changed when you call it second
time. Based on my research, the GetNumberOfUsersOnline will be affected
when some of the following methods are called(from the MSDN document)

==================
The last-activity date/time stamp is updated to the current date and
time
when user credentials are validated by way of the ValidateUser or
UpdateUser method or when a call to a GetUser overload that takes no
parameters or one that uses the userIsOnline parameter to specify that
the
>>date/time stamp should be updated.
============

#Membership..::.GetNumberOfUsersOnline Method
http://msdn.microsoft.com/en-us/libr...mbership.getnu
>>mberofusersonline.aspx

Therefore, I wonder whehter any of the methods are called so that all
the
users become activated before you call the GetNumberOfUsersOnline
method
second time. You can also directly validate the database table's
"lastactiviated" field to verify the behavior.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments
and
suggestions about how we can improve the support we provide to you.
Please
>>feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

================================================ ==
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
>>ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent
issues
>>where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each
follow
>>up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach
the
most efficient resolution. The offering is not appropriate for
situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are
best
handled working with a dedicated Microsoft Support Engineer by
contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
================================================ ==
This posting is provided "AS IS" with no warranties, and confers no
rights.

--------------------
From: "Nick" <a@a.com>
Subject: What's the deal with Membership.GetNumberOfUsersOnline?
Date: Wed, 30 Jul 2008 13:58:18 +0100
Hi there,

Membership.GetNumberOfUsersOnline() works great the first time, then
jumps up to the number of users registered in the system.

I have tried enumerating through each user individually and checking
IsOnline which done likewise, first result was 4, then 22 every time
after
>>>>that and it's only be debugging locally using VS.

Either I'm doing something seriously wrong or this function is a
complete joke. I'm opting for the latter personally....

Any input on this would be greatly appreciated.

Nick.




Aug 8 '08 #6
Thanks for your reply Nick,

I have performed some local tests(using the default SQLExpress membership
provider). Here is a test page I used two buttons to simulate two methods
to check Users online:
==============================
public partial class status : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void Button1_Click(object sender, EventArgs e)
{
foreach (MembershipUser user in Membership.GetAllUsers())
{
Response.Write("<br/>" + user.UserName + ": " + user.IsOnline);
}
}
protected void Button2_Click(object sender, EventArgs e)
{
Label1.Text = "Users Online: " +
Membership.GetNumberOfUsersOnline().ToString();
}
}
======================

It seems the result will keep the same when I press the button multiple
times. BTW, if you have created a new user via "createUserWizard" , the
user may be set to online status. You may need to logout first(also it may
take some time to make it take effect due to the delay used for the
membership to calculate the expire).

for your scenario, do you mean if you click such button multiple times, it
will return different results?

Sincerely,

Steven Cheng
Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>From: "Nick" <a@a.com>
References: <#Q**************@TK2MSFTNGP05.phx.gbl>
<j2**************@TK2MSFTNGHUB02.phx.gbl>
<#Q**************@TK2MSFTNGP06.phx.gbl>
<$8**************@TK2MSFTNGHUB02.phx.gbl>
>Subject: Re: What's the deal with Membership.GetNumberOfUsersOnline?
Date: Fri, 8 Aug 2008 13:43:10 +0100
>
Hi Steven

No it won't you, have completely misunderstood. I wrote that method
as
>an alternative to GetNumberOfUsersOnline, neither of which produce
consistent results.

In fact, that code sample doesn't even have a call to
GetNumberOfUsersOnline in it.

Nick.

"Steven Cheng [MSFT]" <st*****@online.microsoft.comwrote in message
news:$8******************@TK2MSFTNGHUB02.phx.gbl. ..
>Hi Nick,

Per the document, the method call on "MembershipUser.IsOnline" may update
its online status. Therefore, I suggest you try calling
"Membership.GetNumberOfuserOnline" several times without accessing each
user's IsOnline property(remove the foreach loop). I think it will make
the
"Membership.GetNumberOfuserOnline" call return the consistent result.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

Aug 11 '08 #7
Hi Steven,

I have found the problem, further down in the code there is an offending
GetUser call, this has been fixed and now the problem is resolved. Thanks a
million for your time, it's been most appreciated.

Nick.

"Steven Cheng [MSFT]" <st*****@online.microsoft.comwrote in message
news:ZI****************@TK2MSFTNGHUB02.phx.gbl...
Thanks for your reply Nick,

I have performed some local tests(using the default SQLExpress membership
provider). Here is a test page I used two buttons to simulate two methods
to check Users online:
==============================
public partial class status : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void Button1_Click(object sender, EventArgs e)
{
foreach (MembershipUser user in Membership.GetAllUsers())
{
Response.Write("<br/>" + user.UserName + ": " + user.IsOnline);
}
}
protected void Button2_Click(object sender, EventArgs e)
{
Label1.Text = "Users Online: " +
Membership.GetNumberOfUsersOnline().ToString();
}
}
======================

It seems the result will keep the same when I press the button multiple
times. BTW, if you have created a new user via "createUserWizard" , the
user may be set to online status. You may need to logout first(also it may
take some time to make it take effect due to the delay used for the
membership to calculate the expire).

for your scenario, do you mean if you click such button multiple times, it
will return different results?

Sincerely,

Steven Cheng
Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

==================================================
This posting is provided "AS IS" with no warranties, and confers no
rights.
--------------------
>>From: "Nick" <a@a.com>
References: <#Q**************@TK2MSFTNGP05.phx.gbl>
<j2**************@TK2MSFTNGHUB02.phx.gbl>
<#Q**************@TK2MSFTNGP06.phx.gbl>
<$8**************@TK2MSFTNGHUB02.phx.gbl>
>>Subject: Re: What's the deal with Membership.GetNumberOfUsersOnline?
Date: Fri, 8 Aug 2008 13:43:10 +0100
>>
Hi Steven

No it won't you, have completely misunderstood. I wrote that method
as
>>an alternative to GetNumberOfUsersOnline, neither of which produce
consistent results.

In fact, that code sample doesn't even have a call to
GetNumberOfUsersOnline in it.

Nick.

"Steven Cheng [MSFT]" <st*****@online.microsoft.comwrote in message
news:$8******************@TK2MSFTNGHUB02.phx.gbl ...
>>Hi Nick,

Per the document, the method call on "MembershipUser.IsOnline" may
update
its online status. Therefore, I suggest you try calling
"Membership.GetNumberOfuserOnline" several times without accessing each
user's IsOnline property(remove the foreach loop). I think it will make
the
"Membership.GetNumberOfuserOnline" call return the consistent result.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


Aug 21 '08 #8
You're welcome Nick.

Glad that you've figured it out!

Sincerely,

Steven Cheng
Microsoft MSDN Online Support Lead

--------------------
>From: "Nick" <a@a.com>
Subject: Re: What's the deal with Membership.GetNumberOfUsersOnline?
Date: Thu, 21 Aug 2008 10:54:48 +0100
>Hi Steven,

I have found the problem, further down in the code there is an offending
GetUser call, this has been fixed and now the problem is resolved. Thanks
a
>million for your time, it's been most appreciated.

Nick.

"Steven Cheng [MSFT]" <st*****@online.microsoft.comwrote in message
news:ZI****************@TK2MSFTNGHUB02.phx.gbl. ..
>Thanks for your reply Nick,

I have performed some local tests(using the default SQLExpress membership
provider). Here is a test page I used two buttons to simulate two methods
to check Users online:
==============================
public partial class status : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void Button1_Click(object sender, EventArgs e)
{
foreach (MembershipUser user in Membership.GetAllUsers())
{
Response.Write("<br/>" + user.UserName + ": " +
user.IsOnline);
> }
}
protected void Button2_Click(object sender, EventArgs e)
{
Label1.Text = "Users Online: " +
Membership.GetNumberOfUsersOnline().ToString();
}
}
======================

It seems the result will keep the same when I press the button multiple
times. BTW, if you have created a new user via "createUserWizard" , the
user may be set to online status. You may need to logout first(also it
may
>take some time to make it take effect due to the delay used for the
membership to calculate the expire).

for your scenario, do you mean if you click such button multiple times,
it
>will return different results?

Sincerely,

Steven Cheng
Microsoft MSDN Online Support Lead
Aug 22 '08 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
by: Helge Jensen | last post by:
I've got some data that has Set structure, that is membership, insert and delete is fast (O(1), hashing). I can't find a System.Collections interface that matches the operations naturally offered...
3
by: ad | last post by:
I have create a custom membership provider. The common usage of custom membership is set it as default Membership Provider win web.config, and use login controls with it. How can I use custom...
4
by: Pony Tsui | last post by:
I was install the starter kits CLUB, and created a CLUB WEB SITE, this application use the MemberInfo table in club.mdf to store the membership'data, but i can not find out where to define or...
2
by: Balaji | last post by:
Hi All, Can I use more than one membership provider for a given website? I understand only one of them could be default one. If yes, then how to programmatically access the other membership...
3
by: ryan.mclean | last post by:
Hello everyone, I am wondering, can the membership provider be changed at runtime? Perhaps the connectionStringName? I would like to use a different database based on the server the site is...
4
by: thomas | last post by:
Hello All, How to change the default Membership Provider during the runtime? I know I can reference any provider I want, e.g.: provider = Membership.Providers but the question is how to...
4
by: =?Utf-8?B?U2FsYW1FbGlhcw==?= | last post by:
Hi, I am trying to play with the Survey manager application provided gracefully by Microsoft at "http://msdn.microsoft.com/vstudio/express/sql/samples/" VB team(so many thanks), compiled the win...
12
by: Darrel | last post by:
I'm still having a hell of a time figuring out this whole SQL Express set up. I finally discovered why I couldn't run the aspnet_regsql...my local sql server wasn't running. I turned that on,...
6
by: Jonathan Wood | last post by:
Although this will be a challenge at my level of ASP.NET knowledge, I'm thinking I should implement my own membership provider class. Looking over the methods I must implement, a number of...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.