I think the C# ASP.NET SiteMap uses URL as a dictionary key internally since it has to lookup by URL all the time, and forces them to be unique. I want to use that lookup table, but I can't seem to find access to it.
What is the most efficient way to get a specific SiteMapNode by URL? Is there access to it?
My use case is that I want to make a navigation bar populated from the sitemap, starting with the node that's two deep from the root, in my current node's parent chain.
I found it. It's the SiteMapProvider class that provides the method, not SiteMap or SiteMapNode, where I was looking. See http://msdn.microsoft.com/en-us/library/system.web.sitemapprovider.findsitemapnodefromkey.aspx.
I was able to use it like this:
var node = SiteMap.Provider.FindSiteMapNodeFromKey(key);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With