HTTP Error 403.14 - Forbidden - The Web server is configured to not list the contents of this directory

Aindriú picture Aindriú · Sep 24, 2013 · Viewed 534.5k times · Source

I just created a new empty website in Visual Studio 2012 and clicked on run (i.e view in browser) and I get this error :

HTTP Error 403.14 - Forbidden The Web server is configured to not list the contents of this directory.

I went into IIS and clicked on Directory browsing and then ensured that Directory browsing was enabled but I still get this error. I can't figure it out ?

The website project I just created is not listed in Default web sites in IIS Manager which I thought was odd.

How do I get rid of this error ?

Answer

user3943211 picture user3943211 · Aug 16, 2014

keep this into your web config file then rename the add value="yourwebformname.aspx"

<system.webServer>
    <defaultDocument>
       <files>
          <add value="insertion.aspx" />
       </files>
    </defaultDocument>
    <directoryBrowse enabled="false" />
</system.webServer>

else

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