Enable/Disable directory browsing by using web.config - Windows Only Print

  • 10

Scenario: Let's say I want to enable directory browsing for a special directory on my site, how do I enable that? It's as easy as: 1) create (or edit) the web.config file in your site's home directory 2) edit it as follows:

<configuration>
<location path="special_directory_name_here">
<system.webServer>
<directoryBrowse enabled="true" />
</system.webServer>
</location>
</configuration>

Note you will need to change the location path to equal the directory name you want to enable directory browsing for. If you want to enable it for the entire site, just remove the entire and tags (which tell IIS7 to scope the configuration changes to just the path specified). To disable directory browsing just set enabled="false" instead of true.


Was this answer helpful?

« Back