Sometimes it’s useful to be able to access the current RouteData from outside a controller, for instance in a library class. In webforms you could always do
but in Asp.Net MVC it’s a bit less obvious how you get access to this data.
I’ve found the following code works:
Whether there is an easier way or not I don’t know, but this will do me for now…