当当前操作未在 MVC.sitemap 文件中列出时,是否可以强制站点地图控件呈现菜单?
我有一个简单的顶部导航。当当前操作在站点地图中时,调用.Menu()
将呈现正确的<ul><li>..
数据。但是,如果我访问了一个不在站点地图中的页面,例如 /Home/Login,那么它根本不会呈现任何 html(甚至没有评论,只是空白)。这不是[authorize]
问题;当我在“/Home/Index”时,菜单很好。
似乎它应该呈现所请求的内容,但只是不设置IsCurrentNode
andIsNodeInPath
属性。这是我正在打的电话
<div id="main-nav">
@Html.MvcSiteMap().Menu(0, true, true, 1)
</div>
Mvc.sitemap 文件:
<mvcSiteMapNode title="Home" controller="Home" action="Index">
<mvcSiteMapNode title="Form New Human" controller="Person" action="Create"/>
<!-- there is no mvcSiteMapNode for "Home" "Login" -->
</mvcSiteMapNode>