在过去的几个小时里,这一直让我发疯。我正在使用 MVC Sitemap Provider 添加面包屑功能。
让我完成我所做的步骤,以便尽可能清楚地说明这一点
- 从 Nuget 下载资源
然后我的站点地图中有以下内容
<?xml version="1.0" encoding="utf-8" ?>
<mvcSiteMapNode title="Vehicles" controller="Vehicles" area="Vehicles" action="Index"> <mvcSiteMapNode title="VehicleName" controller="Vehicles" area="Vehicles" action="Showroom" > <mvcSiteMapNode title="Overview" area="Vehicles" controller="Vehicles" action="Overview" /> </mvcSiteMapNode> </mvcSiteMapNode>
我认为这是
@Html.MvcSiteMap().SiteMapPath()
我的第一个问题是:如何用我的实际 VehicleName 替换“VehicleName” for action Showroom?
我的实际问题是:我的 id 没有保留给父母。例如,我的 url 将是 localhost:44357/Vehicles/Overview/Soul/1,而父 url 将是 localhost:44357/Vehicles/Showroom,而不是 localhost:44357/Vehicles/Showroom/Soul/1。url 中的车辆名称是可选的,因此 url 可以是 localhost:44357/Vehicles/Showroom/1。
我希望这是有道理的
谢谢你的帮助。