Copied to clipboard

Flag this post as spam?

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


  • Doogie Talons 183 posts 318 karma points
    Jun 08, 2016 @ 16:34
    Doogie Talons
    0

    Having trouble with Basic Membership umbraco 7.4.3

    I used the basic scripts that come with umbraco.

    Created a member etc.

    Run the login on a page and it does not error.

    But it does not seem to actually log me in.

    So I popped this code under the login and it tells me Not Loggedin

    @{ var loginStatusModel = Members.GetCurrentLoginStatus();}
        @if (loginStatusModel.IsLoggedIn)
    {
        <p>You are currently logged in as @loginStatusModel.Name</p>
    
    
    }else{
        <p>Not Loggedin</p>}
    

    In the logs it states.

    2016-06-08 17:50:03,040 [P6424/D2/T11] INFO Umbraco.Core.Security.UmbracoMembershipProviderBase - Login attempt succeeded for username anewmember from IP address xx.xx.xx.xx

    So it s in a sort of limbo where.. The following code

    <p>STATUS MODEL | @loginStatusModel.IsLoggedIn </p>
    <p>MEMBERS : @Members.IsLoggedIn() </p>
    

    Renders as

    STATUS MODEL | False

    MEMBERS : True

  • David Armitage 505 posts 2073 karma points
    Jun 09, 2016 @ 05:09
    David Armitage
    1

    Hi,

    I normally create an helper method for this. In-fact a have a full set of helper methods to help handle the membership.

    To login....

    public static bool ValidateUser(string username, string password, bool setAuthCookie)
            {
                if (Membership.ValidateUser(username, password))
                {
                    if(setAuthCookie)
                    {
                        FormsAuthentication.SetAuthCookie(username, true);
                    }
                    return true;
                }
    
                return false;
            }
    

    Hope this helps.

    Kind Regards

    David

  • Doogie Talons 183 posts 318 karma points
    Jun 09, 2016 @ 07:43
    Doogie Talons
    0

    Thanks for this. I found the problem and it wasn't where I expected.

    Pre live we put the site into Anonymous Authentication Disabled : Windows Authentication Enabled

    Weird that we could still login to umbraco as a user once logged in via the NT password. But for some reason it messed about with the Members module. It also wrote the line Authentication Windows in the web config.

    So whilst trouble shooting we changed the web config back to Forms and set the authentication modes in IIS to how it will be when live and everything works.

    Thanks for your reply though.

    Doogie

Please Sign in or register to post replies

Write your reply to:

Draft