473,698 Members | 2,283 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

What's the deal with Membership.GetN umberOfUsersOnl ine?

Hi there,

Membership.GetN umberOfUsersOnl ine() 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 3767
Hi Nick,

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

According to your scenario, the number changed when you call it second
time. Based on my research, the GetNumberOfUser sOnline 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..:: .GetNumberOfUse rsOnline Method
http://msdn.microsoft.com/en-us/libr...mbership.getnu
mberofusersonli ne.aspx

Therefore, I wonder whehter any of the methods are called so that all the
users become activated before you call the GetNumberOfUser sOnline 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****@microsof t.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.GetN umberOfUsersOnl ine?
Date: Wed, 30 Jul 2008 13:58:18 +0100
>
Hi there,

Membership.GetN umberOfUsersOnl ine() 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****@microsof t.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.GetN umberOfUsersOnl ine?
>
Hi Nick,

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

According to your scenario, the number changed when you call it second
time. Based on my research, the GetNumberOfUser sOnline 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..: :.GetNumberOfUs ersOnline Method
http://msdn.microsoft.com/en-us/libr...embership.getn
u
>mberofusersonl ine.aspx

Therefore, I wonder whehter any of the methods are called so that all the
users become activated before you call the GetNumberOfUser sOnline method
second time. You can also directly validate the database table's
"lastactiviate d" 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;
MembershipUserC ollection pMUCUsers = Membership.GetA llUsers();
foreach (MembershipUser pMUrUser in pMUCUsers)
{
pIntCurCount += (pMUrUser.IsOnl ine ? 1 : 0);
}
lblUsersOnline. Text = String.Format(" Users Online : {0} - ",
pIntCurCount.To String());

---

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 GetNumberOfUser sOnline 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.comw rote in message
news:j2******** ******@TK2MSFTN GHUB02.phx.gbl. ..
Hi Nick,

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

According to your scenario, the number changed when you call it second
time. Based on my research, the GetNumberOfUser sOnline 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..:: .GetNumberOfUse rsOnline Method
http://msdn.microsoft.com/en-us/libr...mbership.getnu
mberofusersonli ne.aspx

Therefore, I wonder whehter any of the methods are called so that all the
users become activated before you call the GetNumberOfUser sOnline 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****@microsof t.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.GetN umberOfUsersOnl ine?
Date: Wed, 30 Jul 2008 13:58:18 +0100
>>
Hi there,

Membership.GetN umberOfUsersOnl ine() 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.Get NumberOfuserOnl ine" several times without accessing each
user's IsOnline property(remove the foreach loop). I think it will make the
"Membership.Get NumberOfuserOnl ine" 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****@microsof t.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************ **@TK2MSFTNGHUB 02.phx.gbl>
>Subject: Re: What's the deal with Membership.GetN umberOfUsersOnl ine?
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;
MembershipUserC ollection pMUCUsers = Membership.GetA llUsers();
foreach (MembershipUser pMUrUser in pMUCUsers)
{
pIntCurCount += (pMUrUser.IsOnl ine ? 1 : 0);
}
lblUsersOnline. Text = String.Format(" Users Online : {0} - ",
pIntCurCount.T oString());

---

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 GetNumberOfUser sOnline 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.comw rote in message
news:j2******* *******@TK2MSFT NGHUB02.phx.gbl ...
>Hi Nick,

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

According to your scenario, the number changed when you call it second
time. Based on my research, the GetNumberOfUser sOnline 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..: :.GetNumberOfUs ersOnline Method
http://msdn.microsoft.com/en-us/libr...mbership.getnu
>mberofusersonl ine.aspx

Therefore, I wonder whehter any of the methods are called so that all the
users become activated before you call the GetNumberOfUser sOnline method
second time. You can also directly validate the database table's
"lastactiviate d" 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****@microsof t.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.GetN umberOfUsersOnl ine?
Date: Wed, 30 Jul 2008 13:58:18 +0100
>>>
Hi there,

Membership.GetN umberOfUsersOnl ine() 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 GetNumberOfUser sOnline, neither of which produce
consistent results.

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

Nick.

"Steven Cheng [MSFT]" <st*****@online .microsoft.comw rote in message
news:$8******** **********@TK2M SFTNGHUB02.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.Get NumberOfuserOnl ine" several times without accessing each
user's IsOnline property(remove the foreach loop). I think it will make
the
"Membership.Get NumberOfuserOnl ine" 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****@microsof t.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************ **@TK2MSFTNGHUB 02.phx.gbl>
>>Subject: Re: What's the deal with Membership.GetN umberOfUsersOnl ine?
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;
MembershipUserC ollection pMUCUsers = Membership.GetA llUsers();
foreach (MembershipUser pMUrUser in pMUCUsers)
{
pIntCurCount += (pMUrUser.IsOnl ine ? 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 GetNumberOfUser sOnline is buggy? It doesn't produce a
consistentl y 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.comw rote in message
news:j2****** ********@TK2MSF TNGHUB02.phx.gb l...
>>Hi Nick,

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

According to your scenario, the number changed when you call it second
time. Based on my research, the GetNumberOfUser sOnline 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.. ::.GetNumberOfU sersOnline Method
http://msdn.microsoft.com/en-us/libr...mbership.getnu
>>mberofuserson line.aspx

Therefore, I wonder whehter any of the methods are called so that all
the
users become activated before you call the GetNumberOfUser sOnline
method
second time. You can also directly validate the database table's
"lastactiviat ed" 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****@microsof t.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
professiona l 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.GetN umberOfUsersOnl ine?
Date: Wed, 30 Jul 2008 13:58:18 +0100
Hi there,

Membership.GetN umberOfUsersOnl ine() 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.P age
{
protected void Page_Load(objec t sender, EventArgs e)
{

}
protected void Button1_Click(o bject sender, EventArgs e)
{
foreach (MembershipUser user in Membership.GetA llUsers())
{
Response.Write( "<br/>" + user.UserName + ": " + user.IsOnline);
}
}
protected void Button2_Click(o bject sender, EventArgs e)
{
Label1.Text = "Users Online: " +
Membership.GetN umberOfUsersOnl ine().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 "createUserWiza rd" , 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****@microsof t.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************ **@TK2MSFTNGHUB 02.phx.gbl>
<#Q************ **@TK2MSFTNGP06 .phx.gbl>
<$8************ **@TK2MSFTNGHUB 02.phx.gbl>
>Subject: Re: What's the deal with Membership.GetN umberOfUsersOnl ine?
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 GetNumberOfUser sOnline, neither of which produce
consistent results.

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

Nick.

"Steven Cheng [MSFT]" <st*****@online .microsoft.comw rote in message
news:$8******* ***********@TK2 MSFTNGHUB02.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.Ge tNumberOfuserOn line" several times without accessing each
user's IsOnline property(remove the foreach loop). I think it will make
the
"Membership.Get NumberOfuserOnl ine" 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.comw rote in message
news:ZI******** ********@TK2MSF TNGHUB02.phx.gb l...
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.P age
{
protected void Page_Load(objec t sender, EventArgs e)
{

}
protected void Button1_Click(o bject sender, EventArgs e)
{
foreach (MembershipUser user in Membership.GetA llUsers())
{
Response.Write( "<br/>" + user.UserName + ": " + user.IsOnline);
}
}
protected void Button2_Click(o bject sender, EventArgs e)
{
Label1.Text = "Users Online: " +
Membership.GetN umberOfUsersOnl ine().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 "createUserWiza rd" , 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****@microsof t.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************ **@TK2MSFTNGHUB 02.phx.gbl>
<#Q************ **@TK2MSFTNGP06 .phx.gbl>
<$8************ **@TK2MSFTNGHUB 02.phx.gbl>
>>Subject: Re: What's the deal with Membership.GetN umberOfUsersOnl ine?
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 GetNumberOfUser sOnline, neither of which produce
consistent results.

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

Nick.

"Steven Cheng [MSFT]" <st*****@online .microsoft.comw rote in message
news:$8****** ************@TK 2MSFTNGHUB02.ph x.gbl...
>>Hi Nick,

Per the document, the method call on "MembershipUser .IsOnline" may
update
its online status. Therefore, I suggest you try calling
"Membership.G etNumberOfuserO nline" several times without accessing each
user's IsOnline property(remove the foreach loop). I think it will make
the
"Membership.Get NumberOfuserOnl ine" 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.GetN umberOfUsersOnl ine?
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.comw rote in message
news:ZI******* *********@TK2MS FTNGHUB02.phx.g bl...
>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.P age
{
protected void Page_Load(objec t sender, EventArgs e)
{

}
protected void Button1_Click(o bject sender, EventArgs e)
{
foreach (MembershipUser user in Membership.GetA llUsers())
{
Response.Write( "<br/>" + user.UserName + ": " +
user.IsOnline);
> }
}
protected void Button2_Click(o bject sender, EventArgs e)
{
Label1.Text = "Users Online: " +
Membership.Get NumberOfUsersOn line().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 "createUserWiza rd" , 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
13828
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 by Sets. - ICollection cannot decide containment - IList promises indexability by the natural numbers, which is not achievable (since i hash elements, not sort them). - IDictionary is definatly not setlike. Although I can, of course, define...
3
7130
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 membership provider without Login Controls? For example, the name of my custom membership provider MyMembershipProvider. Is the codes below right? MyMembershipProvider myProvider=new MyMembershipProvider();
4
1510
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 configure the MemberShipProvider relative to the MemberInfo Table, it just define the connectionString in the web.config. thanks. -- Pony Tsui
2
14144
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 provider? For e.g. lets say I have a SQLMembership provider and OracleMembership provider. SQL would be my default provider. During authentication, based on the value of an additional parameter in the login screen, I need to validate against SQL or...
3
3278
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 on. I suppose that a custom provider could be used to accomplish this, is there another way?
4
7227
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 change the default one, so all those new, cool controls can start using the one I want. I can specify the provider for each of those controls, e.g.:
4
1439
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 app, added 2 users beside the "thardy" user already shipped with the aplication. I can not pass the Login page, I always get the following message on the login page : "Your login attempt was not successfull" In spite of the fact I tried to...
12
10962
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, and now I can see a list of DBs running locally. However, the .mdf file I have in my app_data folder does NOT appear on this list.
6
2929
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 questions come to mind. 1. How would one implement GetNumberOfUsersOnline? I'm not sure where there is any indication of this? And it this affected by the "Remember me next time" checkbox, which doesn't seem to work like it does on any other site...
0
8676
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9164
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9029
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8898
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7734
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3051
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2332
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2006
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.