Question

I'm trying to utilize the HTML.ActionLinks in MVC. I have a route definition like so:

routes.MapRoute(
    name: "RestaurantCommon",
    url: "Rest/{siteName}/Admin/{action}/{id}",
    defaults: new { controller = "AdminCommon", action = "Promotions", id = UrlParameter.Optional }
);

Is it possible to use ActionLinks to keep the "Rest" and "Admin" in the folder structure? Below is what I have. It works but doesn't keep the pattern I want (it works because of a default below the one I defined above)

<li>@Html.ActionLink("Burger Star", "Promotions", "AdminCommon", new { siteName="BurgerStar" }, null)</li>
Était-ce utile?

La solution

Use @RouteLink

@Html.RouteLink("Burger Star", "RestaurantCommon", new { siteName = "BurgerStar" })
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top