Quantcast
Channel: Web Developer Source
Viewing all articles
Browse latest Browse all 12

Enable or Disable Directory Browsing in IIS

$
0
0

This tip will show you how to enable or disable directory Browsing in IIS 7 and below .

IIS supports a directory browsing mode where you can view a list of files and directories instead of viewing an web page (HTML page).

This is very useful for tip when you have a lot of  folders and files  and  such as an music file (.mp3)collection.

To enable this mode you select either a Physical or Virtual directory in the Internet Information Services (IIS) application and select properties and then select the Directory Browsing check box as shown below.

Enable or Disable Directory in IIS 6

Directory Browsing in IIS

Enable or Disable Directory Browsing in IIS

Hiding Files

If you don’t want to show or use  some files or folder in your directory browsing, you must hide the files using Windows Explorer file properties dialog.

 

Enable Browsing

Note: If you mark the file as hidden even if you know the name of the file you can not download the file (an HTTP 404 error will be produced)

 

Why do my Virtual Directories not show up in the browse list?


file list in browser

 

In the example above we have a virtual directory called Music which is pointing to D:\music (directory browsing has been enabled for the Web Site Root and also for the Music Virtual directory)

When you browse the web site you do not see the Music Virtual directory.

file list in browser

This is a special case where IIS does not show the virtual directory but if you knew the name of the virtual directory and manually entered it into the address bar you would see the files as shown below.

The way to make sure your users can see the virtual directory while they are browsing the root is to create a physical directory with the same name in the physical folder of the parent directory.

So in our case our parent directory points to c:\inetpub\websites\directorybrowsing so we must create a folder called Music in the c:\inetpub\websites\DirectoryBrowsing folder.

Nothing has to exist in this new empty Music directory and as soon as you create the folder and refresh the listing you will see the directory shown in the web browser and you have the ability to navigate into it as we would any other directory.

 

Enable Directory Browsing in IIS 7

  1. Connect to your server via Remote Desktop.
  2. Open IIS; Click Start > Administrative Tools > Internet Information Services (IIS) Manager
  3. Expand the servername and then expand Sites to drop down the hosted sites
  4. Select the site you wish to enable directory browsing for or folder beneath

 


Viewing all articles
Browse latest Browse all 12

Trending Articles