1

我有以下结构

  • 登录.aspx
  • 真正安全/homepage.aspx

    我正在尝试允许匿名访问 login.aspx 和 windows 身份验证到 realsecure/homepage.aspx

    我的 IIS 身份验证配置为仅启用匿名。

    这是我的 web.config

    <?xml version="1.0"?>
    <configuration>
    <location path="reallysecure">
    <system.webServer>
      <security>
        <authentication>
          <windowsAuthentication enabled="true"></windowsAuthentication>
        </authentication>
      </security>
    </system.webServer>
    

    当我导航到 login.aspx 时,一切都按预期工作。但是,当我重定向到 realsecure/homepage.aspx 时,我收到以下错误:

    HTTP Error 500.19 - Internal Server Error
    
    The requested page cannot be accessed because the related configuration data for the page is invalid.
    
    81:         <authentication>
      82:           <windowsAuthentication enabled="true"></windowsAuthentication>
     83:         </authentication>
    

    我如何设置 web.config 和 IIS 来完成我的需要?

    谢谢!

  • 4

    1 回答 1

    0

    这是身份验证与授权的问题。Windows 身份验证应设置在根级别,并应用于整个站点。但是在根级别,您将指定允许匿名用户,并在“reallysecure”中指定不允许匿名用户。

    因此,设置一个授权部分,而不是该位置的身份验证部分:

    <authorization>
    <deny users="?"/>
    </authorization>
    

    (?==匿名)

    而且,在根级别,它应该是:

    <authorization>
    <allow users="*"/>
    </authorization>
    

    (* == 所有用户,包括匿名用户)

    于 2013-04-26T18:20:18.617 回答