Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I am trying to display a list of the users that are currently online on my Umbraco site.
I tried using the:
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?
If you look at the source, the provider implements the method like this:
public override int GetNumberOfUsersOnline()
Which calls this method:
public static Hashtable CachedMembers()
// Check for member hashtable in cache
if (memberCache["umbracoMembers"] == null)
umbracoMembers = new Hashtable();
umbracoMembers = (Hashtable)memberCache["umbracoMembers"];
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?
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:
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.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted