IIS7 includes an all-new distributed configuration option, which allows for IIS7 configuration to be stored in web.config files, along with asp.net configuration, to be deployed with your content. This makes transferring IIS7 configuration from your Vista PC to your hosted server as easy as copying files! Read more about this in the Delegating Configuration section of http://learn.IIS.net
In this post, I'll show how easy it is to enable directory browsing for your Web site or a directory on your site. This method will work on any IIS7 web server, and it will be ignored on all non-IIS7 web servers, so it should be safe to do no matter the type of application or content.
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 <location> and </location> tags (which tell IIS7 to scope the configuration changes to just the path specified). Enjoy!
PS:
Hi Bill I read your blog about "How to enable directory browsing with IIS7 web.config" (http://blogs.iis.net/bills/archive/2008/03/24/how-to-enable-directory-browsing-with-iis7-web-config.aspx#comments) Chris added a comment that he likes to know if it's possible to hide files from being displayed in the directory list. It's correct that you can't configure this behavior through web.config, but it works if you just set the file as "hidden" on the filesystem. I'm writing you because i'm not registered, so maybe you could add this information on the blog entry or in the comments.Would be nice because i didn't find this information anywhere, I figured it out by myself. RegardsJens
Comments