I can't get a catch all route to work in MVC. I have tried to implement what is shown in this question, but it does not work. I have a controller called OnlineController with an Index action. My RouteConfig.cs is set up like this:
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapMvcAttributeRoutes();
AreaRegistration.RegisterAllAreas();
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id =
UrlParameter.Optional }
);
routes.MapRoute("RouteName", "{*url}", new { controller =
"Online", action = "Index" });
}
Browsing to the following URL
Blockquote http://mysite/online/something
gives a 404. Why is it not caught and redirected to the index action on the Online controller?