MVC gives me 403 forbidden error with default route when it is called DocumentationController

Is the DocumentationController reserved for system use or something else?

I created an empty MVC application, created a DocumentationController with an appropriate view. It works if I go to www.mysite.com/Documentation/Index , but if I go to www.mysite.com/Documentation/ , then I get a forbidden ban.

Renaming the DocumentationController to Documentation2Controller and its associated views, it (the default route, etc.) works fine.

Is this a reserved keyword, or could it be another reason why he does not choose the default route?

+6
source share
2 answers

Make sure you do not have a virtual / physical directory named Documentation .

You can also instruct MVC to β€œtake over” the request, even if it matches the directory by setting the RouteExistingFiles flag to true (in your routes configuration):

 public static void RegisterRoutes(RouteCollection routes) { routes.RouteExistingFiles = true; //... } 
+30
source

No problem using this word as the name of the controller. (At least in ASP.NET MVC3)

The only backup words are: http://bitquabit.com/post/zombie-operating-systems-and-aspnet-mvc/

0
source

Source: https://habr.com/ru/post/971660/


All Articles