MVC controller gives me a 403 forbidden error with the default route when it's called DocumentationController

后端 未结 2 1062
逝去的感伤
逝去的感伤 2020-11-30 13:51

Is DocumentationController reserved for system usage or something?

I created a blank MVC app, created a DocumentationController with corresponding view.

相关标签:
2条回答
  • 2020-11-30 14:37

    There is no problem using this word as controller name. (At least in ASP.NET MVC3)

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

    0 讨论(0)
  • 2020-11-30 14:38

    Make sure you don't have an actual virtual/physical directory named Documentation.

    You can also instruct MVC to 'take over' the request even when it matches a directory by setting the RouteExistingFiles flag to true (in your Routes configuration):

    public static void RegisterRoutes(RouteCollection routes)
    {
        routes.RouteExistingFiles = true;
    
        //...
    }
    
    0 讨论(0)
提交回复
热议问题