I created a few pages within our Sitecore setup to be accessed only by the Sitecore administrator while our site was still running on 8.2, using
Sitecore.Context.IsAdministrator
to check if the user was an administrator or not on the controller level. After upgrading to Sitecore 9.1 the same line of code does not work anymore and is always returning false due to the user now being seen as
extranet\anonymous
Is there any way I can get the correct logged in user? as I suspect this has something to do with identityserver.
Edit: these pages are like Sitecore admin pages, but instead of creating aspx pages and storing them under the sitecore\admin folder in the webroot, they are Sitecore items built using MVC and are saved under the main Sitecore tree.
The process into navigating to them would be like this:
1- Sitecore admin log's into Sitecore
2- Sitecore admin navigates to the following URL: https://hostname/securepages/mysecurepage
and can view the page.
Sitecore.Context.User.Name
100% still works in 9.1 for a normal login viaAuthenticationManager.Login(accountName, password, rememberMe);