Shop example: CurrentNode is null

May 26, 2010 at 10:16 PM


I write ASP.NET pages a  long time and now I am starting to because familar with MVC in my free time.

For this reason I started a little project to build up a little shop system in MVC.
To retrieve my products out of the database i came to this cool project for an MVC SiteMap. First: Thank you!

The example in the sample projects also looks perfect for me.

I was not able to make the whole sample project running with VisualStudio 2010, but I copied the important codeparts to my project.

It works fine now for the products-index and the ProductsList. But I cannot make the Detail-View working.

In the Details-ActionResult the CurrentNode is null and I do not have an idea why (using the current MvcSiteMap 1.1 Release from January):

 [MvcSiteMapNode(ParentKey = "ProductsListCategory", Title = "Product details", IsDynamic = true, DynamicParameters = "id", Visibility = MvcSiteMapNodeVisibility.InSiteMapPathOnly)]
        public ActionResult Details(string id)
 if (string.IsNullOrEmpty(id))
                id = "ASP.NET MVC 1.0 Quickly";

            // Get category
            string category = products.Where(p => p.Key == id).First().Value;

            // Set sitemap node title
            SiteMap.CurrentNode.Title = string.Format("{0}", id);


The id is defined as well as the category when I run the debugger. But SiteMap.CurrentNode is null.

Can anybody give me a hint what´s going wrong or at which point I have to concentrate for debugging?



May 28, 2010 at 4:40 PM


I´ve solved my problem. The problem was, that I am using MVC2 and had to use the web.config for MVC2 in the mvcsitemap sample folder.