我有这个xml sitemap:
<?xml version="1.0" encoding="utf-8" ?>
<mvcSiteMap xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://mvcsitemap.codeplex.com/schemas/MvcSiteMap-File-4.0" xsi:schemaLocation="http://mvcsitemap.codeplex.com/schemas/MvcSiteMap-File-4.0 MvcSiteMapSchema.xsd">
<mvcSiteMapNode title="Home" controller="Home" action="Index" key="home">
<mvcSiteMapNode title="Access Control" route="AccessControl_default" controller="Home" action="Index" key="access-control">
<mvcSiteMapNode title="My dashboard" route="AccessControl_default" controller="Dashboard" action="Index" key="dashboard"/>
<mvcSiteMapNode title="Personnel" route="AccessControl_default" clickable="false" key="personnel">
<mvcSiteMapNode title="Groups" route="AccessControl_default" controller="Personnel" action="Groups" key="groups"/>
<mvcSiteMapNode title="Members" route="AccessControl_default" controller="Personnel" action="People" key="people"/>
</mvcSiteMapNode>
</mvcSiteMapNode>
</mvcSiteMapNode>
</mvcSiteMap>
这是在区域路由配置中定义的目标路由。
context.MapRoute(
"AccessControl_default",
"accesscontrol/{controller}/{action}/{id}",
new { controller = "Home", action = "Index", id = UrlParameter.Optional },
new[] { "UI.WebPortal.Areas.AccessControl.Controllers" }
);
导航菜单树显示@Html.MvcSiteMap().SiteMap()
,但使用@Html.MvcSiteMap().SiteMapPath()
时面包屑不工作。是因为我明确地使用了路由吗?解决办法是什么呢?
当您使用区域时,只需将area="...."
添加到它们下面的节点
...
<mvcSiteMapNode title="Groups" route="AccessControl_default" area="AccessControl" controller="Personnel" action="Groups" key="groups"/>
...