Enable or disable the display of a directory’s file tree through a web browser. Can prove useful during development or within an intranet. Should be off for public-facing production servers (unless very specifically required).

Disable Directory Browsing

To prevent directory listings from being generated add the following code in the <system.webServer> node in web.config, as shown:

<system.webServer>
	<directoryBrowse enabled="false" />
</system.webServer>

Enable Directory Browsing

To allow directory listings to be generated upon request to a given directory, add the following to the <system.webServer> node in web.config, as shown:

<system.webServer>
	<directoryBrowse enabled="true" showFlags="Date,Time,Extension,Size" />
</system.webServer>

This will display the date, time, file extension, and size in addition to the directory’s subdirectory and file names in the listing.