如何禁用目录浏览Web.Config中 [英] How to disable Directory Browse in Web.Config
问题描述
我有一个网站,我woud喜欢的从 web.config文件中拒绝目录浏览器
I have a WebSite and I woud like Deny Directory Browser from a web.config file.
在这里,code我使用放在根。
不工作。我与URL进行本地测试,这让喜欢的http://本地主机:3214 / 我仍然可以浏览该目录来回CMS
Here the code I'm using placed in the ROOT. Does not work. I'm testing it Locally so with URL LIKE http://localhost:3214/ I can still browser the directory fro CMS.
- 我在做什么错了?
- 如果它甚至在本地机器工作?
感谢您的支持!
<configuration>
<location path="Cms">
<system.webServer>
<directoryBrowse enabled="false" />
</system.webServer>
</location>
</configuration>
有些资源:
<一个href=\"http://blogs.iis.net/bills/archive/2008/03/24/how-to-enable-directory-browsing-with-iis7-web-config.aspx\">http://blogs.iis.net/bills/archive/2008/03/24/how-to-enable-directory-browsing-with-iis7-web-config.aspx
<一个href=\"http://www.expta.com/2008/03/configuring-virtual-directories-with.html\">http://www.expta.com/2008/03/configuring-virtual-directories-with.html
推荐答案
第一:并非一切都工作在一个&LT;地点&gt;
块
First: not everything works in a <location>
block.
我无法找到一个积极的语句&LT; system.webServer&GT;
中不支持&LT;地点&gt;
,但我不能找到它被认为是允许任何案件。证据这是在(全球)的machine.config
其中 system.webserver
部分被定义为使用 IgnoreSection
处理程序:即。它不是由标准的 System.Configuration
实施处理,它是标准实施的配置操作提供支持&LT;地点&gt;
。
I cannot find a positive statement that <system.webServer>
isn't supported in a <location>
, but I cannot find any cases where it is suggested that it is allowed. Evidence for this is in the (global) machine.config
where the system.webserver
section is defined to use the IgnoreSection
handler: ie. it isn't processed by the standard System.Configuration
implementation, and it is that standard implementation of config handling that provides support for <location>
.
尝试添加的web.config
与 CMS
文件夹中的 directoryBrowse
元素,确认浏览被封锁。
Try adding a web.config
into the Cms
folder with the directoryBrowse
element to confirm that browsing is blocked.
这篇关于如何禁用目录浏览Web.Config中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!