views:

47

answers:

1

Hi there

I am using webformrouting in my asp.net c# application.

In my global.asax file i define a couple of routes.

My question is, how can i get a list of all routes defined from code behind (on a page)?

+2  A: 

You can access the Routes property on the RouteTable

System.Web.Routing.RouteTable.Routes;
Brandon
sorry for sounding stupid, but how does that return me a list of all routes?
Dusty Roberts
Maybe I'm not understanding the question correctly, but this will return a RouteCollection. This collection contains all the defined routes. See http://msdn.microsoft.com/en-us/library/system.web.routing.routecollection.aspx
Brandon
i get this when using your example: method all has 1 parameter but is invoked with 0 arguments
Dusty Roberts
Oops, my mistake. You don't need the .All()
Brandon
thanx... it works like a charm :)
Dusty Roberts