Multiple Paths directing to the same URL

Jul 22, 2011 at 7:28 PM

how do i setup my sitemap configuration and dynamic nodes provider to achieve multiple paths that direct to the same URL

for example the following paths

Home > Category > Product

Home > Category > Subcategory > Product

Home > Subcategory > Product

Home > Featured > Product

Home > Product


with Category, Subcategory and Product being dynamic nodes



Jul 25, 2011 at 10:19 AM

DynamicNodeProviders can specify the key/parentkey properties of a node, this should be a good solution to solve this.

Jul 25, 2011 at 11:00 AM
i am using dynamic providers now by creating seperate classes , a lot
of them. is there another way to accomplish this in one go.

maybe by having a helper property in the dynamicnodeprovider base
class so i can change the parent key based on the parent node calling
the dynamicnodeprovider

thanks for the great project, am building the whole site including the
inner pages by just using the nodes and thier properties and the html
Jul 25, 2011 at 11:06 AM

For the helper property: do you have a suggestion on how you would like to use that? (pseudocode or something is fine)

Jul 25, 2011 at 11:25 AM
i will look at the source code and let. you know soon
Jul 25, 2011 at 1:43 PM

i took a quick look at the source and found the following 


DefaultSiteMapProvider.cs : Line 912



        /// <summary>
        /// Adds the dynamic nodes for node.
        /// </summary>
        /// <param name="node">The node.</param>
        /// <param name="parentNode">The parent node.</param>
        private void AddDynamicNodesFor(SiteMapNode node, SiteMapNode parentNode)
            // Dynamic nodes available?
            if (!HasDynamicNodes(node))

            // Build dynamic nodes
            var mvcNode = node as MvcSiteMapNode;
            foreach (var dynamicNode in mvcNode.DynamicNodeProvider.GetDynamicNodeCollection().ToList())
                string key = dynamicNode.Key;
                if (string.IsNullOrEmpty(key))
                    key = NodeKeyGenerator.GenerateKey(Guid.NewGuid().ToString(), mvcNode.Url, mvcNode.Title, mvcNode.Area, mvcNode.Controller, mvcNode.Action, mvcNode.Clickable);



you can pass in the parentNode to  "mvcNode.DynamicNodeProvider.GetDynamicNodeCollection()" 

that property would help in some node creation scenarios

also you can think of implementing a global dynamicnode provider, so dynamic node creation happens in one place, and nodes can be added to any level in the sitemap.

Sep 19, 2011 at 7:37 PM

Can you please post code of what you ended up doing? I have a site that has multiple paths to a page and cannot figure it out.

Sep 19, 2011 at 8:44 PM
The quick answer is to add a querystring that you wont use.
It will make sure that when you add the same multiple urls in the
sitemap file or dynamiclly you wont get an error