I am having this window security popup to ask for username and password. It is like everytime i visit the my site, i am asked to enter them. Btw it is working fine at vs2010 development but not after i publish to IIS. However if i choose another method by enabling Anoymonous Authentication, it works but my HttpContext.Current.User.Identity.Name shows empty.
Can anyone help me to remove this annoying pop-up?
The following are my authentication:
- Anoymonous Authentication (Disabled)
- ASP.NET Impersonation (Disabled)
- Forms Authentication (Disabled)
- Windows Authentication (Enabled)
Code from web.config:
<system.web>
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/></assemblies></compilation>
<authentication mode="Windows" />
<identity impersonate="false"/>
<membership>
<providers>
<clear/>
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/"/>
</providers>
</membership>
<profile>
<providers>
<clear/>
<add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/"/>
</providers>
</profile>
<roleManager enabled="false">
<providers>
<clear/>
<add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/"/>
<add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/"/>
</providers>
</roleManager>
</system.web>
You don’t mention where you are trying to publish your web site.
If this is on an intranet, then first make sure that Internet Explorer uses Windows Authentication by default.
Internet Options-> Advanced->Security->Enable Integrated Windows Authentication. Also, if there’s a cross domain scenario, make sure you have trusts between them.It could also be a permission issue. Since you don’t specify impersonation, the account the you have set for the application pool needs to have all the necessary permission to access the resources you are trying to use (if any), for example DB, Files etc.
If you are trying to publish to a public internet IIs, then Windows Authentication can’t work seamlessly. If this is your scenario then you have to live with the prompt, since IIs can’t validate your (usually NTLM or Kerberos) security token.
On a publicly exposed IIs, Forms Authentication (or OAuth, ACS etc.) makes more sense.