How to enable directory browsing with IIS7 web.config

IIS7 includes an all-new distributed configuration option, which allows for IIS7 configuration to be stored in web.config files, along with 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

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:


<location path="special_directory_name_here">
    <directoryBrowse enabled="true" />



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!


Hi Bill I read your blog about "How to enable directory browsing with IIS7 web.config" ( 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



  • You can also read my blog posting "Configuring Virtual Directories with Directory Browsing in IIS7" at

  • Nice little article.

    Can you also define web.config to "hide" certain files/file extensions when directory browsing. e.g. I would like web.config not to appear in the directory listing (I know it is secure from download but it is confusing for end users etc.)


  • Hi Chris -

    Unfortunately there isn't a way to 'hide' files from within the directory listing module. Our current directoryListingModule doesn't support that feature. The good news is if you want you can easily replace our directoryListingModule with a custom one that does this. Mike Volodarsky has some sample code for this up on his blog -

Comments have been disabled for this content.