The web server is configured not to list the contents of this directory

Asked

Viewed 4,366 times

0

My project ran smoothly, when I needed to divide them into Areas. Then all my old controller (which ran perfectly) was migrated to a certain Area. The areas have been mapped and even updated Routeconfig. However, this error is giving.

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

Do you know how I can fix it without having to change specific permissions in the directory? Like, just by adjusting the project in visual studio.

Created area: "General"
URL: Controller: "Main" / Action: "Index"

Meu RouteConfig está assim:
routes.MapRoute(
                name: "Default",
                url: "Areas/Geral/{controller}/{action}/{id}",
                defaults: new { controller = "Principal", action = "Index", id = UrlParameter.Optional }
  • Which URL are you trying to access? What is the name of the areas you created? What is the name of the controller that should receive the request? He’s within what area?

  • jbueno, see if the update I made answers your question.

  • And what is the URL that gives this 403 error?

  • It would be the starting URL. http://localhost:51454/ where it is configured in route config to Controller: "Principal" , Action: "Index"

  • 1

    Tried ? defaults: new { area = "General", controller = "Main", action = "Index", id = Urlparameter.Optional }

  • LP.Gonçalves, gives the same error.

  • @Brunoheringer Area set in default

  • blz... I even managed to evolve, but now the error is that "The view 'Index' or its master was not found or no view engine Supports the searched Locations. The following Locations Were searched: ~/Views/Login/Index.cshtml"

Show 3 more comments

1 answer

0


To log the solution here: My Maproute needed to look like this (with the . Datatokens):

  routes.MapRoute(
        name: "Default",
        url: "{controller}/{action}/{id}",
        defaults: new { area = "Geral", controller = "Principal", action = "Index", id = UrlParameter.Optional }
    ).DataTokens.Add("area", "Geral");

and so:

context.MapRoute(
                "Geral_default",
                "Geral/{controller}/{action}/{id}",
                new { area = "Geral", controller = "Principal", action = "Index", id = UrlParameter.Optional }
            );

Browser other questions tagged

You are not signed in. Login or sign up in order to post.