3

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 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.