禁止除umbraco管理员外的所有用户访问目录

时间:2020-09-30 16:05:24

标签: iis web-config umbraco umbraco7

我在默认Umbraco目录下创建了一个文件夹。我尝试在此新创建的文件夹中添加一个web.config文件,然后添加以下配置

<configuration>
<system.webServer>
      <security>
          <authorization>
             <allow user="umbracoUsername"/> 
             <deny users="*"/>
          </authorization>
      </security>
  </system.webServer>
</configuration>

目的是仅允许 Umbraco管理员(在设置为 Administrators 的组中)访问此目录和内容,

>

以上内容允许所有用户访问此目录/内容,而我所看到的所有示例均与上面的内容相似。

我在做错什么吗?该站点在IIS(Windows Server 2012)和im上使用Umbraco 7运行。

1 个答案:

答案 0 :(得分:0)

您的web.config配置错误,您可以参考以下代码:

<configuration>
<system.web>
    <!-- This section denies access to all files in this application except for those that you have not explicitly specified by using another setting. -->
    <authorization>
        <deny users="?" />
    </authorization>
</system.web>
<!-- This section gives the unauthenticated user access to the umbracoonly. It is located in the same folder as this configuration file. -->
<location path="umbraco">
    <system.web>
        <authorization>
            <allow users ="*" />
        </authorization>
    </system.web>
</location>
</configuration>

有关配置对特定文件和文件夹的访问的更多信息,您可以参考以下链接:Configure access to a specific file and folder

相关问题