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.
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?
A guess: Is your ajax request a GET request? Browsers have a habit of caching those. Changing it to a POST request might help.
That was the problem indeed! Just changed it to a POST request, and it's solved. Thanks!
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.
is working on a reply...