Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can you determine the name of the route followed from your webforms page?

I have a ASP.NET 3.5 webforms project I have enabled routing over. I also have in the project a number of controls doing different things based on what page they are currently being shown in. It would seem that the most straightforward way to control this different behavior is to discover which route was used to load the page and then do things according to that.

However, I can't seem to find a way to discover the route bar looking at the actual request URL and running a regex over it which isn't great. Does anyone know a way to look it up some other way?

Update: there still doesn't appear to be a way to do this in ASP.NET 4.0. Hopefully someone else has figured this out?

like image 469
Dan Maharry Avatar asked Oct 26 '22 22:10

Dan Maharry


1 Answers

It looks like Phil Haack has answered this question in a blog post on his site: http://haacked.com/archive/2010/11/28/getting-the-route-name-for-a-route.aspx

like image 172
Dan Maharry Avatar answered Nov 13 '22 00:11

Dan Maharry