Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTTP Error 403.14 - Forbidden - MVC 4 with IIS Express

Tags:

This seems like a question that has already been asked/answered many times. Its not.

Development Environment: VS 2012 and MVC 4. I am using the built in IIS Express to run the app.

This error was not occurring until yesterday. It suddenly began to occur and I am stuck. Its strange that It occurs only in ONE scenario.

When I try to access http://localhost:49962/managescholars/, it shows me the error

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

But using http://localhost:49962/managescholars/Index works fine. Other action methods of same controller also work fine. such as http://localhost:49962/managescholars/create. All other controllers work fine as well.

I have tried adding the following to web.config.

<system.webServer>   <validation validateIntegratedModeConfiguration="false"/>   <modules runAllManagedModulesForAllRequests="true" />   <handlers/> </system.webServer> 

I also have tried running the following command as administrator

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

But none of them worked.

Edit:

I have modified my routes. They look as follows.

    public static void RegisterRoutes(RouteCollection routes)     {         routes.IgnoreRoute("{resource}.axd/{*pathInfo}");          routes.MapRoute(             name: "ManageScholarLectures",             url: "Manage/Lectures/{userFriendlyName}",             defaults: new { controller = MVC.ManageLectures.Name ,                              action = MVC.ManageLectures.ActionNames.Index,                              userFriendlyName = UrlParameter.Optional }         );          routes.MapRoute(             name: "ManageScholarEdit",             url: "Manage/Scholars/{userFriendlyName}",             defaults: new { controller = MVC.ManageScholars.Name,                              action = MVC.ManageScholars.ActionNames.Edit }         );          routes.MapRoute(             name: "Default",             url: "{controller}/{action}/{id}",             defaults: new { controller = MVC.Home.Name,                              action = MVC.Home.ActionNames.Index,                              id = UrlParameter.Optional }         );     } 

I am using T4MVC template.

It still does not work even if I leave the default route at the bottom and remove the first two routes. What have I done wrong?

Thanks a lot in advance for your help.

like image 823
Aamir Avatar asked Jun 25 '13 12:06

Aamir


People also ask

What is Error 403 Forbidden access is denied?

The 403 Forbidden error means that your server is working, but you no longer have permission to view all or some of your site for some reason. The two most likely causes of this error are issues with your WordPress site's file permissions or . htaccess file.

How do you resolve the Web server is configured to not list the contents of this directory?

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


1 Answers

Your routes seems fine. This should not cause any problem. The error is occuring only on http://localhost:49962/managescholars/ which means that there might be some other resource with same name. Can you make sure your code does not mistakenly creates a folder managescholars during execution?"

like image 119
Yaqub Ahmad Avatar answered Nov 02 '22 04:11

Yaqub Ahmad