我有这条路线

routes.MapRoute(
    "ViewGames",     // Route name
    "psp/{controller}/{action}",                           // URL with parameters
    new { controller = "Games"}  // Parameter defaults
);

我用了 <%= Html.ActionLink("God of War", "godofwar", "Games")%> 尽管一切都给了我这样的链接 somesite.com/psp/games/godofwar/ 但是另一个链接也变得像这样 somesite.com/psp/home/about/?

如何调用路由名称,以便其他人没有视图路由?

我不想尝试这个 <a href="/psp/games/godofwar/"> 这不好..。

有帮助吗?

解决方案

您明确地使用

<%: Html.RouteLink("link_text", "route_name", route_parameters) %>

HTML.ROUTELINK的所有过载是 这里

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top