1and1 Help Centre Categories

print article

Enable/Disable File Listing (MS 2008)

For Windows hosting packages

On Microsoft hosting packages, Directory Listing (file listing, file browsing, etc) is disabled by default. Because of this, if you would try to access a subfolder of your webspace filled with pictures such as (http://domain.com/images/), you would likely receive a 404 Error. The 404 error generates because the web server was looking for a default or index page in the images/ subfolder. Since only pictures are saved in this subfolder, the server does not display the list of files but produces an error that no page was found. This is the default action so that no one is able to view a listing of your potentially sensitive web site files should they stumble upon this subfolder.

Sometimes it will be necessary to display the files contained in a folder for easy access (with no login). Open up your web.config file in a text editor and add the following line:

<directoryBrowse enabled="true" />

An example is shown below with the above line added in bold.

<configuration>
<system.webServer>
<defaultDocument enabled="true">
<files>
<clear/>
<add value="index.aspx" />
<add value="index.asp" />
<add value="index.htm" />
<add value="index.html" />
<add value="home.aspx" />
<add value="home.asp" />
<add value="home.htm" />
<add value="home.html" />
<add value="default.aspx" />
<add value="default.asp" />
<add value="default.htm" />
<add value="default.html" />
</files>
</defaultDocument>
<directoryBrowse enabled="true" />
<security>
<authentication>
<basicAuthentication enabled="true" />
</authentication>
</security>
<httpErrors errorMode="Custom">
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="404" prefixLanguageFilePath="" path="/OaOInternal/DefaultWebs/sedoCurrent/Error404.aspx" responseMode="ExecuteURL" />
</httpErrors>
</system.webServer>
</configuration>

Save the changes to your web.config file with this added line and then upload it to the root of your webspace. Then refresh the page in your browser. You should see a listing of files!

For additional information, you may want to reference: