IsInCurrentPath Deep Child returns false

Jul 27, 2011 at 9: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:

And my site map looks like:

<?xml version="1.0" encoding="utf-8" ?>
<mvcSiteMap xmlns="" enableLocalization="true">
  <mvcSiteMapNode title="Home" controller="Home" action="Index" >
    <mvcSiteMapNode title="MenuItem" area="A" controller="B" action="Index" />

Then A and B return False for IsInCurrentPath.

If I enter, then they return true.

Is there a way to override this behavior?


Jul 28, 2011 at 2: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.

Aug 26, 2011 at 1: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.