If you look at the source, the provider implements the method like this:
public override int GetNumberOfUsersOnline()
{
return umbraco.cms.businesslogic.member.Member.CachedMembers().Count;
}
Which calls this method:
public static Hashtable CachedMembers()
{
Hashtable umbracoMembers;
// Check for member hashtable in cache
if (memberCache["umbracoMembers"] == null)
umbracoMembers = new Hashtable();
else
umbracoMembers = (Hashtable)memberCache["umbracoMembers"];
So I see two options. Either the system is not caching the members (caching is turned off somehow), or the members are not added to the cache when signing in.
You could try using the same type of cache through your own code and see if you are able to store/retrieve data that way. If not, maybe the asp.net caching is turned off or something?
Who is online?
Hi Guys,
I am trying to display a list of the users that are currently online on my Umbraco site.
I tried using the:
[code]Membership.GetNumberOfUsersOnline()[/code]
In the System.Web.Security namespace, but that returns zero. I don't see that method on the Umbraco membership provider.
How do I get that number?
Second, how do I get a list of the user names that are logged in? Can I perhaps even get a list that also contains the last action and action time?
Thanks,
rasb
If you look at the source, the provider implements the method like this:
public override int GetNumberOfUsersOnline()
{
return umbraco.cms.businesslogic.member.Member.CachedMembers().Count;
}
Which calls this method:
public static Hashtable CachedMembers()
{
Hashtable umbracoMembers;
// Check for member hashtable in cache
if (memberCache["umbracoMembers"] == null)
umbracoMembers = new Hashtable();
else
umbracoMembers = (Hashtable)memberCache["umbracoMembers"];
return umbracoMembers;
}
where
private static readonly System.Web.Caching.Cache _memberCache = HttpRuntime.Cache;
So I see two options. Either the system is not caching the members (caching is turned off somehow), or the members are not added to the cache when signing in.
You could try using the same type of cache through your own code and see if you are able to store/retrieve data that way. If not, maybe the asp.net caching is turned off or something?
Hi Morten,
I think you are correct when you say that the users are not being cached.
I tried calling umbraco.cms.businesslogic.member.Member.CachedMembers().Count myself, and this returned zero as well.
I have overridden the membership provider as described here:
http://forum.umbraco.org/yafpostsm46426Account-ActivationVerification-Email.aspx
I log in users through a standard control. Should I log in users in another way?
I don't know how to turn cache on or off. I haven't done anything actively to turn it off.
Thanks,
rasb
is working on a reply...