CurrentNode Is Null When Using Customer/123 Instead of Customer?id=123

May 18, 2012 at 9:17 AM
Edited May 19, 2012 at 6:01 AM

When I used Customers/ViewCustomer?id=123, I can get the SiteMap.CurrentNode correctly.

But when I used Customers/ViewCustomer/123, I can not get the SiteMap.CurrentNode (Which is Null).

How can I get both URL to have the same CurrentNode?

BTW, I am using DynamicNode to create the sitemap.

public class SiteMapNodeProvider : IDynamicNodeProvider    {

        public IEnumerable<DynamicNode> GetDynamicNodeCollection()  {


            yield return new DynamicNode            {               

Key = "4",               

Title = null,               

Controller = "Customers",               

Action = "viewcustomer",               

Area = "Customers",               

ParentKey = "1",                             

Attributes = new Dictionary<string, string> { { "Url", "/Customers/viewcustomer" } },




I am guessing the problem might be when I explicitly set the Url for the Dynamic Node, then request for Customers/ViewCustomer/123 can not get the SiteMap.CurrentNode.

Thank you!