【问题标题】:Deny Folder and direct link access in .NET MVC拒绝 .NET MVC 中的文件夹和直接链接访问
【发布时间】:2015-01-02 12:12:51
【问题描述】:

我在 Web.config 文件中有以下代码

<location path="UserContent">
    <system.web>
      <authorization>
        <deny users="?" />
      </authorization>
    </system.web>
</location>

它拒绝访问指定的文件夹和子文件夹,但仍然可以直接链接访问文件。我该如何解决?

谢谢

【问题讨论】:

    标签: .net asp.net-mvc-5


    【解决方案1】:

    将此添加到&lt;system.webServer&gt;

    <security>
      <requestFiltering>
        <hiddenSegments>
          <add segment="UserContent"/>
        </hiddenSegments>
      </requestFiltering>
    </security>
    

    这将阻止任何人访问文件夹、子文件夹和静态文件。

    【讨论】:

      猜你喜欢
      • 2014-08-28
      • 2015-07-10
      • 1970-01-01
      • 2012-03-06
      • 1970-01-01
      • 2012-07-25
      • 1970-01-01
      • 1970-01-01
      • 2016-03-12
      相关资源
      最近更新 更多