Why does user.identity.name return empty?

Why does user.identity.name return empty?

User.Identity.Name is empty when hosted on IIS. Also IIS asks for cendentials when IP address is put in URL rather than localhost. Please advise how to fix this. Windows and Anonymous Authentication is enabled in IIS. Windows and Anonymous Authentication is enabled in IIS. You cannot have Windows and Anonymous Authentication enabled.

What does user.identity.name mean in Windows Authentication?

Meaning User.Identity.Name. Not sure what you mean. With Windows authentication, User.Identity.Name should return the <Domain>\<SamAccountName> (ie MyCompany\MyUser). And so if this account doesn’t have read access to the site folder,, then IIS see that and will trigger a credential prompt.

When to use httpcontext user identity name is empty?

In case you are deploying it on IIS locally, make sure local machines “Windows Authentication” feature is enabled and “Anonymous Authentication” is disabled. https://grekai.wordpress.com/2011/03/31/httpcontext-current-user-identity-name-is-empty/

What happens if user.identity.isauthenticated is false?

Also if User.Identity.IsAuthenticated is false it means anonymous users are allowed to access the site and Windows auth doesn’t happen because of this. Shreyas.Mura…

User.Identity.Name is empty when hosted on IIS. Also IIS asks for cendentials when IP address is put in URL rather than localhost. Please advise how to fix this. Windows and Anonymous Authentication is enabled in IIS. Windows and Anonymous Authentication is enabled in IIS. You cannot have Windows and Anonymous Authentication enabled.

Meaning User.Identity.Name. Not sure what you mean. With Windows authentication, User.Identity.Name should return the \\ (ie MyCompany\\MyUser). And so if this account doesn’t have read access to the site folder,, then IIS see that and will trigger a credential prompt.

In case you are deploying it on IIS locally, make sure local machines “Windows Authentication” feature is enabled and “Anonymous Authentication” is disabled. https://grekai.wordpress.com/2011/03/31/httpcontext-current-user-identity-name-is-empty/

Also if User.Identity.IsAuthenticated is false it means anonymous users are allowed to access the site and Windows auth doesn’t happen because of this. Shreyas.Mura…