C# 如何停止恼人的窗口安全弹出窗口?

C# 如何停止恼人的窗口安全弹出窗口?,c#,asp.net,visual-studio-2010,C#,Asp.net,Visual Studio 2010,我有这个窗口安全弹出要求用户名和密码。这就像每次我访问我的网站,我被要求进入他们。顺便说一句,它在vs2010开发中运行良好,但在我发布到IIS之后就不行了。但是,如果通过启用匿名身份验证选择另一种方法,则该方法可以工作,但我的HttpContext.Current.User.Identity.Name显示为空。 有人能帮我删除这个讨厌的弹出窗口吗 以下是我的身份验证: 异常身份验证已禁用 ASP.NET模拟已禁用 表单身份验证已禁用 已启用Windows身份验证 web.config中的代码:

我有这个窗口安全弹出要求用户名和密码。这就像每次我访问我的网站,我被要求进入他们。顺便说一句,它在vs2010开发中运行良好,但在我发布到IIS之后就不行了。但是,如果通过启用匿名身份验证选择另一种方法,则该方法可以工作,但我的HttpContext.Current.User.Identity.Name显示为空。 有人能帮我删除这个讨厌的弹出窗口吗

以下是我的身份验证:

异常身份验证已禁用 ASP.NET模拟已禁用 表单身份验证已禁用 已启用Windows身份验证 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>

你没有提到你要在哪里发布你的网站。 如果这是在intranet上,则首先确保Internet Explorer默认使用Windows身份验证。Internet选项->高级->安全->启用集成Windows身份验证。此外,如果存在跨域场景,请确保它们之间存在信任关系。 这也可能是一个权限问题。由于您没有指定模拟,因此您为应用程序池设置的帐户需要具有访问您尝试使用的资源(如果有)所需的所有权限,例如数据库、文件等

如果您试图将IIs发布到公共internet,则Windows身份验证无法无缝工作。如果这是您的场景,那么您必须接受提示,因为IIs无法验证您通常使用的NTLM或Kerberos安全令牌。 在公开的IIs上,表单身份验证或OAuth、ACS等更有意义