umbraco.library:IsLoggedOn() = true() is always false in Internet Explorer and Opera
When logging in to my website i use the following condition to find out wether a use is logged in:
umbraco.library:IsLoggedOn() = true()
In Firefox and Chrome this all works fine, but in IE 10, Opera and Safari this condition always seems to return false. And users with those browsers cannot log in.
Can someone help me quick, cause it's a webshop so its super important.
This could sound a little like it could be a problem with session cookies (specifically what's referred to as "3rd party cookies") - are you serving the shop on the same domain as the rest of the page? Are you by any chance using iframes for the shop contents?
I would guess it's using some standard Membership stuff — but if you're setting this cookie yourself, you need to be checking that one yourself too, when checking to see if the user is logged in?
I'm pretty sure the IsLoggedOn() method "just" delegates to Member.IsLoggedOn() or something similar...
Here's what I usually put in a Template to provide login and logout functionality:
<form runat="server">
<asp:LoginStatus runat="server" ID="VVLoginStatus"
CssClass="loginstate"
LoginText=""
LogoutText="Click here to log out"
/>
<asp:Login runat="server" ID="VVLogin"
CssClass="form"
RenderOuterTable="True"
DisplayRememberMe="False"
FailureText="Wrong login/password"
LoginButtonText="Login"
PasswordLabelText="Password"
PasswordRequiredErrorMessage="You must enter a password"
TitleText=""
VisibleWhenLoggedIn="False"
UserNameLabelText="Login"
UserNameRequiredErrorMessage="You must enter a login"
/>
</form>
I create a page called "Login" and set that one to use the above template.
Then I right-click a node in Content that should be protected and use the "Public Access" item to protect, either using "Role based" or "Simple".
umbraco.library:IsLoggedOn() = true() is always false in Internet Explorer and Opera
When logging in to my website i use the following condition to find out wether a use is logged in:
umbraco.library:IsLoggedOn() = true()
In Firefox and Chrome this all works fine, but in IE 10, Opera and Safari this condition always seems to return false. And users with those browsers cannot log in.
Can someone help me quick, cause it's a webshop so its super important.
Hi Bunnynut,
This could sound a little like it could be a problem with session cookies (specifically what's referred to as "3rd party cookies") - are you serving the shop on the same domain as the rest of the page? Are you by any chance using iframes for the shop contents?
/Chriztian
Hi Chriztian,
Yes, im serving the shop on the same domain as everything else and there are no iframes.
An update:
In my login usercontrel (ascx), i store the member id in session with the following key: clientid.
In both Firefo as Internet Explorer that key is present in session and contains a valid value.
What does umbraco.library:IsLoggedOn() actually test for? a cookie? A sessions value?
I would guess it's using some standard Membership stuff — but if you're setting this cookie yourself, you need to be checking that one yourself too, when checking to see if the user is logged in?
I'm pretty sure the IsLoggedOn() method "just" delegates to Member.IsLoggedOn() or something similar...
/Chriztian
But if that is true, why does is it work in Chrome and Firefox and not in other browser?
I have no idea :-)
Here's what I usually put in a Template to provide login and logout functionality:
/Chriztian
But if that is true, why does is it work in Chrome and Firefox and not in other browser?
When i open the umbraco.dll in .Net Reflector i can see that you are right and it just checks:
When i go deeper i see this:
So when i add the same check to my page:
<span style="display: none;">
<%= ((HttpContext.Current != null && HttpContext.Current.User != null && HttpContext.Current.User.Identity != null) ? HttpContext.Current.User.Identity.IsAuthenticated.ToString() : "USER NOT AVAILABLE")%>
</span>
I get the following results:
Firefox and Chrome return true.
IE, Opera and Safari return false.
Funny thing is that the User object exists but its not authenticated.
Both Firefox and chrome are the only browsers that to remember my credentials, the rest dont do that.
I think it's to do with temp/Session cookies being allowed / denied as Chriztian said.
Rich
"I think it's to do with temp/Session cookies being allowed / denied as Chriztian said."
When i set the "accept cookies from websites" to false in Firefox, i can reproduce the problem there as well.
But accepting all cookies in IE doesnt resolve the issue in that browser
Can somebody please shed some light on this problem?
Its very urgent and ii dont know where to look.
Have you confirmed the same results on a different machine?
First thing you should try is to make sure it's not something that happens for whatever reasons in your own Login control.
Have you tried my sample? If that works you know more already...
/Chriztian
Multiple users have reported this problem since today.
Everything worked fine yesterday.
This is my code for logging in:
Member m = Member.GetMemberFromLoginNameAndPassword(txtEmail.Text, txtPassword.Text);
if (m != null && txtEmail.Text != string.Empty && txtPassword.Text != string.Empty)
{
//HttpContext.Current.Response.Write("ja" + ContinueUrl);
Member.AddMemberToCache(m);
//Add the shopping cart if the client has one
string sSessionID = OrderManagement.SpecialSessionID();
SessionHandler.CurrentClientID = m.Id;
ShoppingCart.MergeShoppingCarts(sSessionID, m.Id);
AmatecWebsite.Extensions.Orders.ShoppingCartManagement.UpdateItemsInShoppingCartMini();
//TO DO: in case a product exists twice
//Response.Write(ContinueUrl + "...");
Response.Redirect(hdnContinueUrl.Value);
}
OK, so then you need to find out what happended today (late yesterday) to have caused this...
These are total guesswork of course - but here hoes:
is working on a reply...