【问题标题】:How to stop annoying window security popup?如何停止烦人的窗口安全弹出窗口?
【发布时间】:2012-03-21 09:51:07
【问题描述】:

我有这个窗口安全弹出窗口询问用户名和密码。就像每次我访问我的网站时,我都被要求输入它们。顺便说一句,它在 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>

【问题讨论】:

    标签: c# asp.net visual-studio-2010


    【解决方案1】:

    您没有提及您尝试在哪里发布您的网站。 如果这是在 Intranet 上,则首先确保 Internet Explorer 默认使用 Windows 身份验证。 Internet Options-&gt; Advanced-&gt;Security-&gt;Enable Integrated Windows Authentication。此外,如果存在跨域场景,请确保它们之间存在信任。
    也可能是权限问题。由于您没有指定模拟,因此您为应用程序池设置的帐户需要拥有所有必要的权限才能访问您尝试使用的资源(如果有),例如数据库、文件等。

    如果您尝试发布到公共 Internet II,则 Windows 身份验证无法无缝运行。如果这是您的情况,那么您必须接受提示,因为 II 无法验证您的(通常是 NTLM 或 Kerberos)安全令牌。 在公开的 II 上,表单身份验证(或 OAuth、ACS 等)更有意义。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-12-20
      • 2011-08-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-05-16
      • 2015-02-09
      • 2020-05-09
      相关资源
      最近更新 更多