【问题标题】:IIS disable authentication in subfolderIIS 在子文件夹中禁用身份验证
【发布时间】:2018-02-06 19:08:21
【问题描述】:

在我的 web.config 应用程序中是:

<authentication mode="Forms">
  <forms loginUrl="app/Login.aspx" name=".ASPXFORMSAUTH" protection="All" slidingExpiration="true" timeout="10"/>
</authentication>
<authorization>
  <deny users="?"/>
  <allow users="*"/>
</authorization>

在app文件夹的web.config中是:

<configuration>
  <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <directoryBrowse enabled="false"/>
    <defaultDocument enabled="true">
      <files>
        <clear/>
        <add value="Default.aspx"/>
      </files>
    </defaultDocument>
    <handlers accessPolicy="Read, Script, Execute"/>
    <staticContent enableDocFooter="false">
      <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="00:00:00"/>
    </staticContent>
    <asp enableParentPaths="false" scriptLanguage="VBScript" bufferingOn="true">
      <limits scriptTimeout="00:01:30"/>
      <session allowSessionState="true" timeout="00:20:00"/>
    </asp>
    <security>
      <authentication>
        <anonymousAuthentication enabled="true" password="" userName="IUSR"/>
        <basicAuthentication enabled="false" realm="" defaultLogonDomain=""/>
        <windowsAuthentication enabled="false"/>
        <digestAuthentication enabled="false" realm=""/>
      </authentication>
    </security>
    <httpLogging dontLog="true"/>
  </system.webServer>
</configuration>

这项工作,但我想为匿名用户授予对 my_public 文件夹的访问权限。 在 my_public 文件夹中是站点 about.aspx。

在 my_public 文件夹的 web.config 中是:

<configuration>
  <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <directoryBrowse enabled="false"/>
    <defaultDocument enabled="true">
      <files>
        <clear/>
        <add value="Default.aspx"/>
      </files>
    </defaultDocument>
    <handlers accessPolicy="Read, Script, Execute"/>
    <staticContent enableDocFooter="false">
      <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="00:00:00"/>
    </staticContent>
    <asp enableParentPaths="false" scriptLanguage="VBScript" bufferingOn="true">
      <limits scriptTimeout="00:01:30"/>
      <session allowSessionState="true" timeout="00:20:00"/>
    </asp>
    <security>
      <authentication>
        <anonymousAuthentication enabled="true" password="" userName="IUSR"/>
        <basicAuthentication enabled="false" realm="" defaultLogonDomain=""/>
        <windowsAuthentication enabled="false"/>
        <digestAuthentication enabled="false" realm=""/>
      </authentication>
    </security>
  </system.webServer>
  <system.web>
    <authorization>     
    <allow roles="*"/>
  </authorization>
</system.web>
</configuration>

当用户转到 my_public/about.aspx 时,总是会重定向到 app/login.aspx。 匿名用户应重定向到 my_public/about.aspx。

【问题讨论】:

    标签: asp.net iis web-config authorization


    【解决方案1】:

    将公共 web.config 上的授权部分更改为

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

    这将允许匿名访问。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-02-12
      • 1970-01-01
      • 2016-06-08
      • 2013-07-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多