How to access/inject RouteData.Values

Topics: Core, Customizing Orchard, General
May 15, 2012 at 1:35 AM

I'm creating a new menu that will be dynamic and I need to know what product I'm viewing to be able to correctly build the menu.

I'm guessing the best way to work out what product is being viewed would be to access the RouteData.Values["ProductId"] what would I inject into my constructor to access this?

Would there be a better way to work out what product is being viewed while in the context of building the menu.

P.S menu is built via implementing: INavigationProvider

May 16, 2012 at 11:43 AM

you could inject IWorkContextAccessor - this would give you access to the current httpcontext so you should be able to find the value in there. (: