Copied to clipboard

Flag this post as spam?

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


  • Peter Morlion 4 posts 24 karma points
    Dec 10, 2010 @ 18:07
    Peter Morlion
    0

    Membership.GetUser() returning previously logged in member

    I'm using Umbraco 4.5.2. I am making an Ajax call to a handler, that, for testing purposes, returns the logged in user name. I read this page (http://our.umbraco.org/wiki/how-tos/membership-providers) so I used:

    System.Web.Security.Membership.GetUser()

    Now, my problem: when I log in as User1, I get 'User1' back, which is correct. Then, I log out, and log in as User2. This time, my code returns 'User1' again.

    Is there caching involved? When I restart my browser, I can log in as User2 and get 'User2' returned. But again, logging out and logging in as another user, will return 'User2' everytime.

    On the same page I have the following macro:

    <xsl:choose>

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

    You are logged in as 

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

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

    </xsl:when>

    <xsl:otherwise>

    You are not logged in.

    </xsl:otherwise>

    </xsl:choose>

    This always returns the correct user. Using the umbraco library in my C# code doesn't solve this by the way.

    Anyone else having the same problem or know how to fix it?

  • Morten Bock 1867 posts 2140 karma points MVP 2x admin c-trib
    Dec 10, 2010 @ 18:36
    Morten Bock
    0

    A guess: Is your ajax request a GET request? Browsers have a habit of caching those. Changing it to a POST request might help.

  • Peter Morlion 4 posts 24 karma points
    Dec 13, 2010 @ 19:51
    Peter Morlion
    0

    That was the problem indeed! Just changed it to a POST request, and it's solved. Thanks!

  • Pete 213 posts 285 karma points
    Sep 18, 2011 @ 15:39
    Pete
    0

    I am having this issue with my  " umbraco v 4.7.0 (Assembly version: 1.0.4090.38017) ".

    Can anyone suggest a fix ?

    I'm thinking that the "auth" cookie isn't getting expired upon logout, then my xlst, which uses:

    <xsl:if test="umbraco.library:IsLoggedOn()">
        <p class="fr" id="loggedIn">
          Welcome <xsl:value-of select="umbraco.library:GetCurrentMember()/@nodeName"/>, <a href="/login.aspx?signout=true">logout</a>
        </p>
      </xsl:if>

    Thinks they're still logged on.

    Thanks.

Please Sign in or register to post replies

Write your reply to:

Draft