MVCSiteMapProvider does not display SiteMapPath

I have a simple site map:

<mvcSiteMapNode title="Projects" controller="Projects" action="Index"> <!--This wraps the entire site since Projects Index is the homepage-->
    <mvcSiteMapNode title="Projects" controller="Projects" action="Index">
      <mvcSiteMapNode title="Project" controller="Projects" action="Details">
        <mvcSiteMapNode title="Session" controller="Session" action="DetailsNew" />
        <mvcSiteMapNode title="Edit Session" controller="Session" action="Edit" />
      </mvcSiteMapNode>
    </mvcSiteMapNode>
    <mvcSiteMapNode title="My Account" controller="Account" action="ChangePassword" />
    <mvcSiteMapNode title="Admin" controller="Admin" action="Index" >
      <mvcSiteMapNode title="Create User" controller="Admin" action="AddUser" />
      <mvcSiteMapNode title="Manage Users" controller="Admin" action="Users" />
    </mvcSiteMapNode>
  </mvcSiteMapNode>

When I put @Html.MvcSiteMap().SiteMapPath()on the Project Details page, nothing is displayed. Ideas?

+3
source share
1 answer

When adding a custom route value (except for "area", "controller" or "action") you need to explicitly specify how to map it.

By default, you must create a node for each potential route key value. For example, if you have a route key named "id", and you have entries with the identifiers "1", "2" and "3", you will need to create a node for each identifier.

<mvcSiteMapNode title="Project 1" controller="Project" action="Details" id="1">
<mvcSiteMapNode title="Project 2" controller="Project" action="Details" id="2">
<mvcSiteMapNode title="Project 3" controller="Project" action="Details" id="3">

, RouteParameters. , node , , CRUD.

<mvcSiteMapNode title="Edit Project" controller="Project" action="Edit" preservedRouteParameters="id">

, , , node ( ) , , node . , FilteredSiteMapNodeVisibilityProvider SiteMapTitleAttribute.

, CRUD, . MvcSiteMapProvider .

+3

All Articles