Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • rasb 162 posts 218 karma points
    May 17, 2009 @ 18:51
    rasb
    0

    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

  • Morten Bock 1867 posts 2140 karma points MVP 2x admin c-trib
    May 17, 2009 @ 23:28
    Morten Bock
    0

    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?

  • rasb 162 posts 218 karma points
    May 18, 2009 @ 01:03
    rasb
    0

    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

Please Sign in or register to post replies

Write your reply to:

Draft