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.. .

1 Answer 1

25

You explicitly call a route using

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

All the overloads for Html.RouteLink are here

Sign up to request clarification or add additional context in comments.

2 Comments

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)
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!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.