C# – Windows authentication keeps asking username password even credentials are correct

asp.netcwindows-authentication

I have developed an application to allow windows authentication and hosted it to the live server. in my local pc i am able to get the username password. but when i am accessing from web (e.g. websso.mydomain.com) it keeps asking credentials even after i entered correct credentials.

<authentication mode="Windows">
</authentication>

<authorization>
  <deny users="?" />
</authorization>
<identity impersonate="true"/>

i have added above tags in web.config, hosting server is windows server 2008 R2. I have tried to get username from

WindowsIdentity.GetCurrent().Name
Environment.Username
Request.ServerVariables["LOGON_USER"]
Request.ServerVariables["AUTH_USER"]
HttpContext.Current.Request.LogonUserIdentity.Name

Is there any changes which needs to do in IIS or any steps to follow to configure windows authentication.

Installed IIS version is 7.5

Best Answer

I had a similar issue recently, try ensuring that the windows user has read access to the directory on the server.

Related Topic