【问题标题】:Block directory access for all except umbraco admin阻止除 umbraco 管理员之外的所有人访问目录
【发布时间】:2020-09-30 16:05:24
【问题描述】:

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

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

目的是只允许 Umbraco 管理员(如在设置为 Administrators 的组中)访问此目录和内容,其他人不得访问。

以上允许所有用户访问此目录/内容,我看到的所有示例都与上述类似。

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

【问题讨论】:

    标签: iis web-config umbraco umbraco7


    【解决方案1】:

    你的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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-07-16
      • 2011-09-21
      • 2012-07-30
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多