Ketan Panchal
Ketan Panchal

Reputation: 230

Windows authentication keeps asking username password even credentials are correct

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

Upvotes: 3

Views: 21308

Answers (4)

Alex
Alex

Reputation: 371

websso.mydomain.com looks like internet domain name, not intranet domain name because it has sections. According to https://support.microsoft.com/en-us/help/258063/internet-explorer-may-prompt-you-for-a-password you should use domain name without sections (e.g. http://websso/) or add your domain name to security settings of client browsers

Upvotes: 2

user5243764
user5243764

Reputation: 21

Checkk application pool owner in IIS

It should be network services

Upvotes: 2

Donal Lafferty
Donal Lafferty

Reputation: 5966

Try updating your <authorization> to include an <allow> element as I have done here.

E.g.

<system.web>
    <authentication mode="Windows" />
    <authorization>
        <allow users="yourdomain\someotheruser" />
        <deny users="?" />
    </authorization>

Upvotes: 0

DLeh
DLeh

Reputation: 24395

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

Upvotes: 2

Related Questions