I\'ve recently hit a road block trying to use the MvcSiteMapProvider.
In my application, I have three distinct areas: Landing, Application and Administration. I curr
I'm using version 4, for which the named providers apparently doesn't work. The prescribed way to have multiple sitemaps in v4 frankly scared the bejeebus out of me and was way more work than I wanted.
Per the @NightOwl888's suggestion comment on his own answer, I used the named helpers option in v4. I still only have one mvc.sitemap file, but I have mutually exclusive visibility options.
Step 1: add this setting to in web.config
Step 2: pick the names of your different "menus" and apply them to the visibility attribute on each node. In my case I had "Regular" and "Admin". Again, all of these are in the same mvc.sitemap file.
You'll note, that the Reports, Downloads and Document links are available to both regular users and admin users, but since admin rarely uses these options, I wanted to put them in the Misc submenu.
Step 3: in your _Layout.cshtml, decide which menu you want to display.
@if(User.IsInRole("Admin"))
{
@Html.MvcSiteMap().Menu("BootstrapMenuHelperModel", false, new { name = "Admin" })
}
else
{
@Html.MvcSiteMap().Menu("BootstrapMenuHelperModel", false, new { name = "Regular" })
}
I used this bootstrap/sitemap tutorial, if you aren't I think you can just call @Html.MvcSiteMap().Menu(new { name = "MENUNAME" })