Reputation: 2339
Web.Config windows authentication showing null username
My WebConfig authentication is enable
C# code I tried
WindowsIdentity.GetCurrent(); // showing null
System.Security.Principal.WindowsIdentity.GetCurrent().Name // showing null
System.Security.Principal.WindowsIdentity.GetCurrent().Name;// showing null
Request.ServerVariables["LOGON_USER"] // showing null
Request.ServerVariables["REMOTE_USER"] // showing null
Upvotes: 0
Views: 799
Reputation: 416
In my case I checked Project properties window.
Anonymous Authentication was set Enabled and Windows Authentication - to Disabled. I changed these values and it helped me.
Upvotes: 1
Reputation: 195
Have you entered like this is Web.Config
<system.web>
<authentication mode="Windows"/>
</system.web>
Upvotes: 1