I am using MVCSiteMapProvider 4.6.7 in an ASP.NET MVC 5 project. I have this in the mvc.sitemap
file:
<mvcSiteMapNode title="UserManager" controller="User" action="Index">
<mvcSiteMapNode title="UserAdd" controller="User" action="Create"/>
<mvcSiteMapNode title="UserEdit" controller="User" action="Edit"
preservedRouteParameters="id"
key="User_Edit"/>
<mvcSiteMapNode title="UserView" controller="User" action="Details"/>
</mvcSiteMapNode>
I am showing a Site Map Path like this:
<div id="breadcrumbNav">
@Html.MvcSiteMap().SiteMapPath()
</div>
When I navigate to http://siteurl/User/Edit/2
, the site map path is displayed, but when I navigate to http://siteurl/User/Edit?id=2
, it is not.
Removing preservedRouteParameters="id"
will reverse the situation ( site map displayed with .../Edit?id=2
, but not with .../Edit/2
)
Is there a way to make them both work?