How do I access a route parameter in my ASP.NET MVC view?

asp.net-mvc, parameters, routes

Solution

This should work in your view:

<%= this.ViewContext.RouteData.Values["id"] %>

(assuming the route parameter is named "id")

Problem

I have an URL like this `/home/action/id` How can I access this id in view?

Original source