ASP.NET MVC Routing with a controller named "PropertiesController"

asp.net, asp.net-mvc, iis-7, routes

Solution

Since someone else is having the same problem, I'm guessing that you're running into a reserved keyword here (I imagine ClassControllers are out as well).

It's not the first time it's happened either - digging deeper into the internals of the environment, you can't route to Windows' reserved keywords either.

Problem

I'm having a tricky issue (bear with me as I'm new to MVC) with trying to use a controller (and a route subsequently) with the name PropertiesController. I believe this is because there is a directory (which I can't really remove) called "Properties" in my solution. Is there a way round this? The route setup is just one simple route: ``` routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Properties", action = "List", id = "" } // Parameter defaults ); ``` and the error I get in IIS7 when requesting "http://localhost/aptment2/properties/" is: Surely there is a way round this that I just can't find? Cheers.

Original source

Related problems