I need to get the windows logged on user name in the Sitecore 9.2 application.

I have enabled windows authentication in IIS ,

and tried with the

HttpContext.Current.User.Identity.Name its always giving me "extranet\anonymous"

And tried with System.Security.Principal.WindowsIdentity.GetCurrent().Name and HttpContext.Current.Request.LogonUserIdentity.Name but no luck.

Need help here to get the windows logged on user name

  • I don't know what you want to achieve here but did you try by disabling the anonymous user and Forms authentication? – Mahendra Shekhawat Sep 29 '20 at 9:20
  • I want to get he windows logged on user name on page load. I need anonymous user in User Manager, so havnet disabled that user. But disbaled the forms authentication. – Mahesh Sep 30 '20 at 7:13

The problem is that in Sitecore 9.2, the “LOGON_USER” returns empty.

Furthermore, when you try to get the windows identity username through the System.Security.Principal.WindowsIdentity.GetCurrent().Name it’s return the Anonymous User, or the application Poll identity name. It will not give you the User that it’s logged in the computer or VM.

The only way to have Windows authentication is to disabled the Sitecore Identity.

More details here: https://medium.com/@jalves_654/enabling-windows-authentication-sitecore-9-2-cfa25705b860

  • Thanks @andrei. – Mahesh Sep 30 '20 at 7:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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