IsInCurrentPath Deep Child returns false

Jul 27, 2011 at 8:11 PM

If I have a path that takes me deeper than the definitions of the site map, then IsInCurrentPath becomes false for all nodes, including valid parent nodes.

For example, my URL is:

http://www.somesite.com/A/B/C

And my site map looks like:

<?xml version="1.0" encoding="utf-8" ?>
<mvcSiteMap xmlns="http://mvcsitemap.codeplex.com/schemas/MvcSiteMap-File-3.0" enableLocalization="true">
  <mvcSiteMapNode title="Home" controller="Home" action="Index" >
    <mvcSiteMapNode title="MenuItem" area="A" controller="B" action="Index" />
  </mvcSiteMapNode>
</mvcSiteMap>

Then A and B return False for IsInCurrentPath.

If I enter http://www.somesite.com/A/B, then they return true.

Is there a way to override this behavior?

 

Jul 28, 2011 at 1:46 PM

After further analysis, it seems that unless there is an exact match on area/controller/action, the library cannot determine where in the site map this page lives. So even if you only want to show levels above, you need an entry for every lower node.

Coordinator
Aug 26, 2011 at 12:28 PM

Which is by design as C is not necessarily a child of A/B in this case. Also, nodes should be added to the sitemap as MvcSiteMap only "knows" nodes defined.