开发者

How to call the Route Name in Html.ActionLink asp.net MVC?

开发者 https://www.devze.com 2023-01-19 08:17 出处:网络
I have this route routes.MapRoute( \"ViewGame开发者_开发知识库s\",// Route name \"psp/{controller}/{action}\",// URL with parameters

I have this route

routes.MapRoute(
    "ViewGame开发者_开发知识库s",     // Route name
    "psp/{controller}/{action}",                           // URL with parameters
    new { controller = "Games"}  // Parameter defaults
);

and I used <%= Html.ActionLink("God of War", "godofwar", "Games")%> all though it gives me a link like this somesite.com/psp/games/godofwar/ but the other link became also like that for example my homecontroller became this somesite.com/psp/home/about/?

how can call the routename so other won't have the ViewGames route?

I dont want to try this <a href="/psp/games/godofwar/"> which is not good.. .


You explicitly call a route using

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

All the overloads for Html.RouteLink are here

0

精彩评论

暂无评论...
验证码 换一张
取 消