Copied to clipboard

Flag this post as spam?

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


  • Bunnynut 136 posts 318 karma points
    Apr 19, 2013 @ 10:19
    Bunnynut
    0

    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.

  • Chriztian Steinmeier 2800 posts 8791 karma points MVP 8x admin c-trib
    Apr 19, 2013 @ 10:43
    Chriztian Steinmeier
    0

    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

  • Bunnynut 136 posts 318 karma points
    Apr 19, 2013 @ 10:50
    Bunnynut
    0

    Hi Chriztian,

    Yes, im serving the shop on the same domain as everything else and there are no iframes.

  • Bunnynut 136 posts 318 karma points
    Apr 19, 2013 @ 11:25
    Bunnynut
    0

    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?

  • Chriztian Steinmeier 2800 posts 8791 karma points MVP 8x admin c-trib
    Apr 19, 2013 @ 11:30
    Chriztian Steinmeier
    0

    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

  • Bunnynut 136 posts 318 karma points
    Apr 19, 2013 @ 11:34
    Bunnynut
    0

    But if that is true, why does is it work in Chrome and Firefox and not in other browser?

  • Chriztian Steinmeier 2800 posts 8791 karma points MVP 8x admin c-trib
    Apr 19, 2013 @ 11:44
    Chriztian Steinmeier
    0

    I have no idea :-)

    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".
    Does this resemble how you do it?

    /Chriztian

  • Bunnynut 136 posts 318 karma points
    Apr 19, 2013 @ 12:07
    Bunnynut
    0

    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:

    public static bool IsLoggedOn()
    {
        return Member.IsLoggedOn();
    }
    

    When i go deeper i see this:

    public static bool IsLoggedOn()
    {
        if (HttpContext.Current.User == null)
        {
            return false;
        }
        return HttpContext.Current.User.Identity.IsAuthenticated;
    }
    

    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.

  • Rich Green 2246 posts 4008 karma points
    Apr 19, 2013 @ 12:20
    Rich Green
    0

    I think it's to do with temp/Session cookies being allowed / denied as Chriztian said.

    Rich

  • Bunnynut 136 posts 318 karma points
    Apr 19, 2013 @ 12:40
    Bunnynut
    0

    "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

  • Bunnynut 136 posts 318 karma points
    Apr 19, 2013 @ 13:32
    Bunnynut
    0

    Can somebody please shed some light on this problem?

    Its very urgent and ii dont know where to look.

  • Rich Green 2246 posts 4008 karma points
    Apr 19, 2013 @ 13:38
    Rich Green
    0

    Have you confirmed the same results on a different machine? 

  • Chriztian Steinmeier 2800 posts 8791 karma points MVP 8x admin c-trib
    Apr 19, 2013 @ 13:40
    Chriztian Steinmeier
    0

    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

  • Bunnynut 136 posts 318 karma points
    Apr 19, 2013 @ 14:41
    Bunnynut
    0

    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);
            }

  • Chriztian Steinmeier 2800 posts 8791 karma points MVP 8x admin c-trib
    Apr 19, 2013 @ 14:50
    Chriztian Steinmeier
    0

    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:

    • You most likely didn't upgrade Umbraco, right?
    • Maybe something changed on the server?
    • Is the database limited in space?
    • Is the disk limited in space?
    • Wrong permissions somewhere?
    • IP change?
    • etc.
    /Chriztian

     

Please Sign in or register to post replies

Write your reply to:

Draft