This is my route registration code:
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"course_list",
"course/list",
new { controller = "course", action = "list" }
);
routes.MapRoute(
"course_view",
"course/view/{id}",
new { controller = "course", action = "list", id = UrlParameter.Optional }
);
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
I have a link /course/view/87
And the route that is matched is /course/list
Can anyone explain why?
Thank you
UPDATE:
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"course_list",
"course/list",
new { controller = "course", action = "list" }
);
routes.MapRoute(
"course_view",
"course/view/{id}",
new { controller = "course", action = "view", id = UrlParameter.Optional }
);
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
But I'm still getting the same issue. When i visit: /course/view/87 i get a 404 error.