I have restricted the the access for the role "**AdminUser**" in the Access viewer as below.

I have restricted the the access for the role "AdminUser" in the Access viewer as above. Later in the code when I am accessing using the below code

                if (Sitecore.Security.Accounts.User.Exists(@"Sitecore\AdminUser"))
                    isAuthenticated = Sitecore.Security.Authentication.AuthenticationManager.Login(@"Sitecore\AdminUser", true);

It is authenticating the user and I am able to see the user role in the Sitecore.Context.User.Roles as "Admin User"

But when we access the Page it loads well and fine. Is there a way I can stop the user with Role "AdminUser" from accessing the page

Note: I am not accessing the item from Sitecore but as a webpage.


  • Does "Admin User" also have the "Administrator" box checked for the user? If so, all security is ignored.
    – sestocker
    Commented Apr 11, 2017 at 22:54
  • No, It is not an administrator role
    – Meghan
    Commented Apr 12, 2017 at 1:27
  • My guess is that Sitecore still thinks "Extranet\Anonymous" is the user. Try outputting the current user in your view somewhere to see what user Sitecore is using.
    – sestocker
    Commented Apr 12, 2017 at 14:04
  • @Meghan were you able to figure this out?
    – Diego
    Commented Sep 18, 2017 at 2:01

3 Answers 3


I think you are restricting the wrong domain. In your code you are checking against the Sitecore domain but you said you are accessing the page as a webpage which by default uses the Extranet domain. More information on domains can be found here.


I agree with @sestocker, May be Sitecore still thinks extranet\anonymous is the user. Debug your code and check what is the context user after your login code. If it does not work I have a auto login code in my blog which also uses Sitecore Ticket manager please try that. This was provided by Sitecore Support.



Can you please try this, Create a new role, let's say "AccessExternalPageName" by default add this rule to all other users and remove this role to Sitecore\AdminUser

Now in you above code check the user role in.

We have tried a type of the same scenario where security access was not captured then added some custom role and identified those checks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.