If I do this in my view
<% Html.RenderAction("RenderAdminMenu", "Shared"); %>
and then have this in controller action RenderAdminMenu:
RouteData rd = route.GetRouteData(Url.RequestContext.HttpContext);
or
RouteData rd = route.GetRouteData(this.HttpContext);
then RouteData returned (rd) is always null.
How come?
1) To access information about the current route:
then go thru the values like this:
2) If, however, we need access to the whole route collection, enumerate them or just do whatever we want (like build up a navigation menu from our routes, which I did) we do it like this:
For this to work you would also need a special NamedTypedRoute class: