tags:

views:

203

answers:

1

I'm using this code in my view to enumerate routes but I am unable to get route names from Route object.

RouteCollection routes = RouteTable.Routes; foreach (RouteBase rb in routes) { Route route = rb as Route;

So how can I get access to route name?

+1  A: 

I've also found this solution by Stephen Walter which enables us to keep the code unmodified (use MapRoute method instead of MapRouteWithName as described in the another solution at Stack):

http://stephenwalther.com/blog/archive/2008/08/03/asp-net-mvc-tip-29-build-a-controller-to-debug-your-custom-routes.aspx

mare