代码之家  ›  专栏  ›  技术社区  ›  Brad

如何在IIS 7.0中允许混合模式身份验证

  •  5
  • Brad  · 技术社区  · 14 年前

    如何使用在IIS 7.0上运行的表单身份验证将Windows用户身份验证到网站?

    1 回复  |  直到 13 年前
        1
  •  9
  •   Brad    14 年前

    创建一个单独的页面来处理Windows登录。此页面将对用户进行身份验证,然后为其设置表单cookie。然后,将该页添加到web.config中,告诉IIS 7在该特定页上使用Windows身份验证。

    <configuration>
    ...
    <!-- this file captures the user and redirects to the login page -->
      <location path="Account/WindowsLogin.aspx">
        <system.web>
          <authorization>
            <allow users="*" />
          </authorization>
        </system.web>
        <system.webServer>
          <security>
            <authentication>
              <windowsAuthentication enabled="true" />
              <anonymousAuthentication enabled="false" />
            </authentication>
          </security>
        </system.webServer>
      </location>
    </configuration>