My routing is not working properly. I have defined the following routes:
routes.MapRoute(
name: "CategoryDetails",
url: "{seoName}",
defaults: new { controller = "Category", action = "Details" }
);
routes.MapRoute(
name: "ContactUs",
url: "contact",
defaults: new { controller = "Home", action = "Contact" }
);
routes.MapRoute(
name: "AboutUs",
url: "about",
defaults: new { controller = "Home", action = "About" }
);
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
When I click on us about us or contact us, he leads me to a method of action with details in the category controller.
This is the markup for me about us and contact us:
@Html.ActionLink("About", "About", "Home")
@Html.ActionLink("Contact", "Contact", "Home")
Powerful action method for category controller:
public ActionResult Details(string seoName)
{
CategoryViewModel model = categoryTask.Details(seoName);
return View(model);
}
What is wrong with my route configuration?
source
share