How do you access the current RouteData from View in .net MVC?

Gene Reddick picture Gene Reddick · Jul 16, 2009 · Viewed 18.8k times · Source

If I want to directly access the RouteData (the current action or parameter values for example) from the View, rather than having to pass it in from the controller as part of the ViewData, what class would i use?

Answer

womp picture womp · Jul 16, 2009
this.ViewContext.RouteData

should do the trick.