Copied to clipboard

Flag this post as spam?

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


  • Anders 10 posts 91 karma points
    Dec 29, 2021 @ 10:26
    Anders
    0

    Umbraco 9 - Cant access restricted webpage when programmatically logged in

    Hi

    After programmatically logged in to Umbraco as a member I can't access the restricted page.

    I've restricted access to a site in umbraco like follows

    enter image description here

    I have a member in the AdminMemberGroup.

    I sign in the member like this:

     var member = await mMemberManager.FindByEmailAsync(email);
                var roles = await mMemberManager.GetRolesAsync(member);
    
                await mSigninManager.SignInAsync(member, false);
    

    Where mMember is IMemberManager

    I check the User.Identity and it seems like I've been logged inenter image description here

    And all of the following return true

                await mMemberManager.IsMemberAuthorizedAsync(allowGroups: new[] { "AdminMemberGroup" });
                await mMemberManager.MemberHasAccessAsync("/test");
                await mMemberManager.IsLoggedIn();
    

    But when trying to access the restricted site I get redirected to the error page. Which should happen when I'm logged in but don't have access.

    Why is this?

  • Darren 1 post 71 karma points
    Jan 05, 2022 @ 15:55
    Darren
    0

    I am experiencing something similar. Have you managed to get to the bottom of this?

    Regards,

    Darren

  • andrew shearer 513 posts 663 karma points
    Nov 14, 2022 @ 02:30
    andrew shearer
    0

    hi - did you find a solution? thanks

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies