Tuesday, July 7, 2009

RouteLink and ActionLink in ASP.NET MVC

For some reason this took me some time to understand.

RouteLink() has 10 overloads. For some reason I couldn't understand that RouteLink went back to the routes.MapRoute() that you originally setup in the global.asax.cs file. That I understand now. The overload that I am currently using the most is:

string HtmlHelper.RouteLink(string linkText, string routeName, string routeValues);


RouteLink("Text that will appear on page", "First param in MapRoute()", new { controller = "Home", action = "Index", id = Model.ID })

ActionLink() on the other hand, I'm now using to route to another action on that same controller or the same action with different parameters.


  1. Hi Ellis, thanks for the short and straight to the point answer. Your post was a solution to what I was really struggling to understand. Looking forward to more of your posts :).

  2. Thanks. Saved my day.

  3. Thanks. Now, i understand the difference between the two better.

  4. Disapointing....
    I was hoping to find a bit more detail on what were the differences of each Helper method between ActionLink and RouteLink and when you should use one or the other.

  5. To the point explanation. Simple yet very powerful.

  6. Great explanation! Thanks for share it!