February 05, 2011

HTTP Error 403.14 - Forbidden

Error:
HTTP Error 403.14 - Forbidden
The Web server is configured to not list the contents of this directory.
Internet Information Services 7.5

Cause:
If did you have ASP .NET Application on IIS 7.0 and in your ASP .NET Form/MVC used Routing or any handler for reroute/rewriting you need to have premession for access to files directories.

Solution A:
Add these lines to Web.config

<httpHandlers>
    <add path="*" verb="*" type="System.Web.HttpNotFoundHandler"/>
</httpHandlers>
<system.webServer>
    <validation validateIntegratedModeConfiguration="false"/>
    <handlers>
        <remove name="BlockViewHandler"/>
        <add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler"/>
    </handlers>
</system.webServer>


Solution B:
The Solution A solved my HTTP Error 403.14 - Forbidden error but give me another error: HTTP Error 404.0 - Not Found. Replaced just this codes instead of Solution A code

<system.webServer>
  <modules runAllManagedModulesForAllRequests="true"> 
    <remove name="UrlRoutingModule"/> 
    <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> 
  </modules> 
</system.webServer>

13 comments:

Alexei said...

Didn't help me, I still have same error. With solution A i got same 500 error. But solution B does not help

Joseph said...

Hi to all,
Has any one found a solution to this problem?
I tried all suggestion but to no avail.

I would appreciate any help.

Amastaneh said...

@ Joseph and Гностик: Really sorry but this problem comes more times ago and i can't produce this in home. If you find it, please share it here

Swapna said...

To resolve this problem, use one of the following methods.


Method 1
To resolve this problem, follow these steps:

Start IIS Manager. To do this, click Start, click Run, type inetmgr.exe, and then click OK.
In IIS Manager, expand server name, expand Web sites, and then click the Web site that you want to modify.
In Features view, double-click Directory Browsing.
In the Actions pane, click Enable.


Method 2
To resolve this problem, follow these steps:

Start IIS Manager. To do this, click Start, click Run, type inetmgr.exe, and then click OK.
In IIS Manager, expand server name, expand Web sites, and then click the Web site that you want to modify.
In Features view, double-click Default Document.
In the Actions pane, click Enable.
In the File Name box, type the name of the default document, and then click OK.

WoutvdVegt said...

It worked, Thanks

Emery Walsh said...

It appears to be like your IIS is not handling the redirecting guidelines for your program and is trying to discover a standard.aspx, catalog.htm, etc.

Anonymous said...

Solution A worked for me. Thanks!

Anonymous said...

This error occurs when you have MVC 2+ running hosted on IIS 7+, this is because ASP.NET 4 was not registered in IIS. In my case I was creating a MVC 3 project and hosting it on IIS 7.5.

To fix it, make sure you have MVC 2 or above and .Net Framework 4.0 installed, then run a command prompt as administrator and type the following line:

32bit (x86)


%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -ir

64bit (x64)

%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -ir

harshal said...

This error occurs when you have MVC 2+ running hosted on IIS 7+, this is because ASP.NET 4 was not registered in IIS. In my case I was creating a MVC 3 project and hosting it on IIS 7.5.

To fix it, make sure you have MVC 2 or above and .Net Framework 4.0 installed, then run a command prompt as administrator and type the following line:

32bit (x86)


%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -ir

64bit (x64)

%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -ir

Unknown said...

where is Features view while expanding Wrb sites.i double click the web site also right click the website but cn't find the features view.please help me..

Unknown said...

After many, many, and oh so many pages of searching the web.config fixes (first for the 403 and then the 404 fixed my problem). With windows 2012 I could not do the regiis and I could see where the 4.5 .Net was installed so those were lost roads and so many other suggestions out there. Thanks for this.

Anonymous said...

Thanks for sharing this with us.

Unknown said...

Can anyone help me?
I try to do what @Harshal said with the command prompt, but it didn't work,
When I try to do like @Swapna, start the IIS Manager. Type inetmgr.exe in Run, but it showed an error:
"Windows cannot find inetmgr.exe".
How can i fix this?