I'd like an alternative to SiteMap.CurrentNode.Clone(true)
which preserves both parents, siblings and children. I'd like to then be able to traverse the SiteMap as if I was accessing the SiteMap directly.
The original problem is listed here
On a particular page I use SiteMap.SiteMapResolve
to edit the parent of CurrentNode. This breaks my code elsewhere which navigates up the stack and then access all ChildNodes at the required level:
SiteMapNode c = System.Web.SiteMap.CurrentNode;
if (jumpsRequired < 0) {
while (jumpsRequired < 0)
{
c = c.ParentNode;
jumpsRequired++;
}
}
return c.HasChildNodes ? c.ChildNodes.Cast<SiteMapNode>() : new List<SiteMapNode>();
Because I am cloning CurrentNode on SiteMap.SiteMapResolve
ChildNodes.Count <= 1 as the clone doesn't copy the siblings.