Copied to clipboard

Flag this post as spam?

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


  • Daniel McAteer 16 posts 136 karma points
    Nov 10, 2017 @ 17:10
    Daniel McAteer
    0

    Membership Provider Login Detection Issue

    I think I'm somehow missing a trick with this, but I can't quite put my finger on what it is, and was hoping someone could point me in the right direction.

    On one of my Umbraco pages, I have a login form, which submits post data to a controller, which then logs the user in using:

    bool authenticated = Members.Login(username, password);
    

    After this point, "authenticated" gets set to true, and the member's "last login date" gets updated with the current timestamp.

    However.. then I assumed for detecting that the user was logged in, I could use one of the following:

    var test_01 = Members.GetCurrentLoginStatus();
    var test_02 = Members.CurrentUserName;
    var test_03 = Members.GetCurrentMember();
    var test_04 = Members.GetCurrentMemberId();
    var test_05 = Members.IsLoggedIn();
    

    but every single one of these fires as if there is no logged in user.

    Little confused as to where I'm going wrong, can anyone lend a hand? :)

  • LeaTark 13 posts 94 karma points
    Nov 10, 2017 @ 17:31
    LeaTark
    0

    Try

    var test_06 = Members.GetCurrentLoginStatus().IsLoggedIn;
    
  • Daniel McAteer 16 posts 136 karma points
    Nov 13, 2017 @ 14:49
    Daniel McAteer
    0

    Yeah, I'd checked the properties inside the LoginStatusModel, and unfortunately, that one is false as well :(

  • John Bergman 483 posts 1132 karma points
    Nov 11, 2017 @ 19:13
    John Bergman
    0

    I've also seen cases where IsLoggedIn is true, but GetCurrentMemberId returns -1.

  • Daniel McAteer 16 posts 136 karma points
    Nov 13, 2017 @ 15:13
    Daniel McAteer
    0

    Ever seen a case where every "logged in" property is false? :p First time I've come across it, and I don't remember having to do any additional config / setup with the other sites I had membership on.

  • Daniel McAteer 16 posts 136 karma points
    Nov 13, 2017 @ 16:11
    Daniel McAteer
    0

    Anyone got any ideas? :)

  • Daniel McAteer 16 posts 136 karma points
    Nov 21, 2017 @ 13:25
    Daniel McAteer
    100

    Just in case anyone else runs into this issue, the cause was down to an issue with my Forms Authentication setup. I had to reconfigure my settings in web.config to resolve.

Please Sign in or register to post replies

Write your reply to:

Draft