I have a rather peculiar issue with routing.
Coming back to routing after not having to worry about configuration for it for a year, I am using the default route and ignore route for resources:
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Default",
// Route name
"{controller}/{action}/{id}",
// URL with parameters
new
{
controller = "Home",
action = "Index",
id = UrlParameter.Optional
});
I have a RulesController
with an action for Index
and Lorem
and a Index.aspx
, Lorem.aspx
in Views > Rules directory.
I have an ActionLink aimed at Rules/Index on the maseter page:
<li><div><%: Html.ActionLink("linkText", "Index", "Rules")%></div></li>
The link is being rendered as http://localhost:12345/Rules/
and am getting a 404.
When I type Index
into the URL the application routes it to the action.
When I change the default route action from "Index"
to "Lorem"
, the action link is being rendered as http://localhost:12345/Rules/Index
adding the Index
as it's no longer on the default route and the application routes to the Index action correctly.
I have used Phil Haack's Routing Debugger, but entering the url http://localhost:12345/Rules/
is causing a 404 using that too.
I think I've covered all of the rookie mistakes, relevant SO questions and basic RTFMs.
I'm assuming that "Rules" isn't any sort of reserved word in routing. Other than updating the Routes and debuugging them, what can I look at?