2012-05-25 54 views
1

我试图使用MvcSiteMapProvider,但创建我自己的自定义布局。我用nuget将MvcSiteMapProvider 3.2.3.0版本安装到我的项目中,并创建了这个文件进行开发。但是,当我试图循环遍历根节点的子节点时,没有任何节点。MvcSiteMap只有根节点

<?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-3.0" 
      xsi:schemaLocation="http://mvcsitemap.codeplex.com/schemas/MvcSiteMap-File-3.0 MvcSiteMapSchema.xsd" 
      enableLocalization="true"> 
    <mvcSiteMapNode title="Home" controller="Home" action="Index"> 
    <mvcSiteMapNode title="Reports" controller="Reports" action="Index"/> 
    <mvcSiteMapNode title="Queries" controller="Queries" action="Index"/> 
    <mvcSiteMapNode title="Tools" controller="Tools" action="Index"> 
     <mvcSiteMapNode title="Markets" controller="Markets" action="Index"> 
     <mvcSiteMapNode title="Boundary Files" controller="Markets" action="BoundaryFiles" /> 
     <mvcSiteMapNode title="Mass Update" controller="Markets" action="MassUpdate" /> 
     <mvcSiteMapNode title="SHOULD NOT BE HERE" controller="Home" action="Headings" /> 
     </mvcSiteMapNode> 
     <mvcSiteMapNode title="Categories" controller="Categories" action="Index"/> 
     <mvcSiteMapNode title="Blasts" controller="Blasts" action="Index"> 
     <mvcSiteMapNode title="Get Blast" controller="Blasts" action="Get" /> 
     </mvcSiteMapNode> 
     <mvcSiteMapNode title="Alerts" controller="Alerts" action="Index"/> 
     <mvcSiteMapNode title="Applications" controller="Applications" action="Index"/> 
    </mvcSiteMapNode> 
    <mvcSiteMapNode title="Subscribers" controller="Subscribers" action="Index" /> 
    </mvcSiteMapNode> 
</mvcSiteMap> 

根节点没有出现任何儿童但是:

enter image description here

我无法弄清楚什么是错的。我已经替换为非常行动得到执行的根源,给它一个类似的孩子,但没有奏效:

<mvcSiteMapNode title="ASDFG" controller="Test" action="TestSiteMap"> 
    <mvcSiteMapNode title="ASDFGHJKL" controller="Test" action="TestSiteMap"/> 

回答

0

这是很难说发生了什么事在这里。如果我不得不猜测,我会说这可能与子节点直接添加到v3中的节点有关,在这种情况下,站点地图无法跟踪它们。该选项已在MvcSiteMapProvider v4中删除,以确保所有节点都直接添加到站点地图并由其内部集合进行跟踪。

我会建议升级,看看这种行为是否可以在v4中重现。