9

I have this route

routes.MapRoute(
    "ViewGames",     // 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.. .

Hogan
  • 69,564
  • 10
  • 76
  • 117
idontknowhow
  • 1,507
  • 5
  • 17
  • 23

1 Answers1

25

You explicitly call a route using

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

All the overloads for Html.RouteLink are here

istruble
  • 13,363
  • 2
  • 47
  • 52
Felix Martinez
  • 3,928
  • 3
  • 31
  • 32
  • 2
    are you sure? the first parameter for RouteLink is the anchor text and the second is route name... so: Html.RouteLink("link_text", "route_name", route_parameters) – davidhq Jun 18 '13 at 18:45
  • 1
    Thank you for this answer. Why doesn't Microsoft provide a textual description of what the method does in their documentation? It gives all the overloads but the overloads of what? What does it do? Hopefully someone at MS reads this! – voam Dec 02 '15 at 21:27