1

I am learning ASP.NET MVC and came across this particular Html Helper method.

When would one use

@Html.RouteLink("Routed Link", new { controller = "Home", action = "About", id="MyID"})

What is the difference between this and Html.ActionLink()?

ckv
  • 10,125
  • 19
  • 96
  • 139

2 Answers2

1

According to: What's the difference between RouteLink and ActionLink in ASP.NET MVC?

ActionLink will generate the URL to get to an action using the first matching route by action name.

RouteLink will generate a URL to a specific route determined either by name or route values.

Community
  • 1
  • 1
whoah
  • 4,163
  • 10
  • 49
  • 81
1

ActionLink is a specific way to link to a specific action by specifying the action and controller. RouteLink gives you more control over the routing. For instance, look at this override which gives you the most flexibility in generating a URL, not necessarily tied to an action.

Brian Mains
  • 50,194
  • 35
  • 142
  • 253