Copied to clipboard

Flag this post as spam?

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


  • nelsenlim 70 posts 71 karma points
    Mar 17, 2011 @ 05:57
    nelsenlim
    0

    GetCurrentMember() issue in umbraco 4.7.0

    umbraco 4.7.0 (March 14, 2011), ASP.Net V 4.0

    Hi so this is the case i do a FormsAuthentication.SignOut()
    Then when i meet a page that has this code

     

     

    <xsl:if test="umbraco.library:IsLoggedOn()">

          You are logged in as

          <span>

            <xsl:variable name="user" select="umbraco.library:GetCurrentMember()/@loginName"/>

            <xsl:value-of select="$user"/>

          </span>

        </xsl:if>

     

    I am logged in again, i am really having trouble with login and logout in umbraco 4.7, does anyone experience the same thing?

    I put a codeplex issue so someone can help to check out http://umbraco.codeplex.com/workitem/30171

    Thank u

    Best regards,
    Nelsen

     

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Mar 17, 2011 @ 08:17
    Jan Skovgaard
    0

    Hi Nelsen

    Are you sure you're logging your users out properly?

    What does the code for logging users out look like?

    /Jan

  • nelsenlim 70 posts 71 karma points
    Mar 17, 2011 @ 08:53
    nelsenlim
    0

    Hi I am using FormsAuthentication.SignOut()

    The thing is if using ASP.Net membership provider http://our.umbraco.org/wiki/how-tos/membership-providers

    Everything works OK but once you start working with umbraco Member that's where the problem is

    Right now i just try to avoid calling Member.GetCurrentMember() cause even if i do FormsAuthentication.SignOut(), it still returns the old member

    Let me show you my visual studio watch windows to show you what's happening 
    http://files.nelsenlim.com/umbracoMembership47.png

    Could it be it's because of the change in
    http://umbraco.codeplex.com/workitem/30072

    Thank u very much for your help

  • nelsenlim 70 posts 71 karma points
    Mar 18, 2011 @ 08:04
    nelsenlim
    0

    using .Net Reflector

    public static bool IsLoggedOn()
    {
    if (HttpContext.Current.User == null)
    {
    return false;
    }
    if (!HttpContext.Current.User.Identity.IsAuthenticated)
    {
    int id = CurrentMemberId();
    if (id > 0)
    {
    FormsAuthentication.SetAuthCookie(new Member(id).LoginName, true);
    return true;
    }
    }
    return HttpContext.Current.User.Identity.IsAuthenticated;
    }

    the call to isLoggedOn would cause a call us SetAuthCookie, i also found out that a cookie named "UMB_Member" is created when i am calling IsLoggedOn() .
    The cookie name seems to be obtained from a constact in this class StateHelper.Cookies.Member

    Right now to ensure everything is removed i do a

                int memberID = Member.CurrentMemberId();
                Member.ClearMemberFromClient(memberID);
               
                FormsAuthentication.SignOut();
                Session.Abandon();

    Apparently just FormsAuthentication.SignOut(); is not enough

Please Sign in or register to post replies

Write your reply to:

Draft