Skip to content

Instantly share code, notes, and snippets.

@joe-oli
Last active August 19, 2019 06:56
Show Gist options
  • Save joe-oli/a3c9c69ddb661f7e7c98eb4f062ac7db to your computer and use it in GitHub Desktop.
Save joe-oli/a3c9c69ddb661f7e7c98eb4f062ac7db to your computer and use it in GitHub Desktop.
disable directory browsing a folder on IIS
//set the Web.config for the site which you want to disable dir-browsing; any child folders within the site are also non-browsable.
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.webServer>
<directoryBrowse enable="false"/>
</system.webServer>
</configuration>
//to scope it to a specific folder within the Site or App, use location tag.
<configuration>
<location path="your/path/here">
<system.webServer>
<directoryBrowse enabled="true" />
</system.webServer>
</location>
</configuration>
//NB: applies only to IIS 7 +; For IIS 6, use IIS Manager to configure this.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment