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)?
You can access the Routes
property on the RouteTable
System.Web.Routing.RouteTable.Routes;
I create a partialView to visualize these in the site to help me from time to time (debugging).
@{
var routes = RouteTable.Routes;
}
@foreach (var route in routes)
{
var r = (System.Web.Routing.Route)route;
<h4>@r.Url</h4>
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With