【发布时间】:2014-07-29 17:11:26
【问题描述】:
我在 ASP.NET MVC 5 项目中使用 MVCSiteMapProvider 4.6.7。我在mvc.sitemap 文件中有这个:
<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>
我正在显示这样的站点地图路径:
<div id="breadcrumbNav">
@Html.MvcSiteMap().SiteMapPath()
</div>
当我导航到http://siteurl/User/Edit/2 时,会显示站点地图路径,但是当我导航到http://siteurl/User/Edit?id=2 时,它不是。
删除preservedRouteParameters="id" 将扭转这种情况(站点地图显示为.../Edit?id=2,但不是.../Edit/2)
有没有办法让它们都工作?
【问题讨论】:
标签: asp.net-mvc asp.net-mvc-routing mvcsitemapprovider asp.net-mvc-sitemap