Problem with multiple sitemaps and the MenuHelper

Mar 31, 2011 at 3:46 PM

I've got a separate section of our site and have decided that the best way to impliment it is as a second sitemap provider. However there's a problem with the MenuHelper not properly dealing with being passed a different provider.

The MvcSiteMapHtmlHelper can take a provider or provider name fine but several of the Menu() extension methods need to find the starting node by a line like:

SiteMapNode startingNode = GetStartingNode(GetCurrentNode(SiteMap.Provider), startingNodeLevel);

This results in the menu being created based on the current default provider. The fix is simple, in MenuHelper.cs just replace all instances of SiteMap.Provider with helper.Provider, this uses the provider that the MvcSiteMapHtmlHelper has been given.

Apr 5, 2011 at 7:32 AM

Fixed in the latest sources. Thanks for reporting!