我正在使用此窗口安全弹出窗口来询问用户名和密码。就像我每次访问我的网站一样,我被要求输入它们。顺便说一句,它在vs2010开发中运行良好,但在我发布到IIS后却没有。但是,如果我通过启用Anoymonous身份验证选择其他方法,它可以工作,但我的HttpContext.Current.User.Identity.Name显示为空。 任何人都可以帮我删除这个烦人的弹出窗口吗?
以下是我的身份验证:
来自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>
答案 0 :(得分:0)
您没有提到您尝试发布网站的位置。
如果这是在Intranet上,则首先确保Internet Explorer默认使用Windows身份验证。 Internet Options-> Advanced->Security->Enable Integrated Windows Authentication
。此外,如果存在跨域方案,请确保它们之间存在信任
它也可能是一个许可问题。由于您未指定模拟,因此您为应用程序池设置的帐户需要具有访问您尝试使用的资源(如果有)的所有必要权限,例如DB,文件等。
如果您尝试发布到公共Internet II,则Windows身份验证无法无缝运行。如果这是您的方案,那么您必须接受提示,因为IIs无法验证您的(通常是NTLM或Kerberos)安全令牌。 在公开曝光的IIs上,表单身份验证(或OAuth,ACS等)更有意义。