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.
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?"