Null Url when using UrlHelper.Action(Action, Controller, RouteValueDict)

Jan 25, 2010 at 2:48 PM

I am having an issue with the MvcSiteMapNode as when I had it render my menu It was giving all the right list items back with anchor tags, but the urls that were produced by the nodes were empty.  After a little digging I found in the Url Property of the MvcSiteMapNode that if I removed the RouteValuesDictionary from the parameters passed into the urlHelper.Action method then I would get the correct answer.  I modified the original code in the Url Property of the MvcSiteMapNode to look like the following, and now it works.  However I am assuming that the RouteValueDictionary was meant for placing values past the {Controller}\{Action}\?{Value}? maybe?  Can anyone please help me understand why the parameter at the end was making the Url come out as null?  I need to understand what I was doing wrong to be able to fix it and be able to be able to use all of it's features.  Your help is much appreciated.

        UrlHelper urlHelper = new UrlHelper(ctx);
        RouteValueDictionary routeValueDictionary = new RouteValueDictionary(RouteValues);
        String urlString = urlHelper.Action(Action, Controller);//, routeValueDictionary);