Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5969597
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:15:12+00:00 2026-05-22T20:15:12+00:00

I am using the ASP.NET MVC SiteMapProvider 3.0 in my MVC3 page (.NET Framework

  • 0

I am using the ASP.NET MVC SiteMapProvider 3.0 in my MVC3 page (.NET Framework 4.0). I switched from SiteMapProvider v2 to 3.0 during development but had the described problem in v2 as well.

The SiteMapProvider is specified in the Web.config like this:

<siteMap defaultProvider="MvcSiteMapProvider" enabled="true">
    <providers>
        <clear/>
        <add name="MvcSiteMapProvider" 
                type="MvcSiteMapProvider.DefaultSiteMapProvider, MvcSiteMapProvider" 
                siteMapFile="~/Web.Sitemap" 
                securityTrimmingEnabled="false" 
                cacheDuration="5" 
                enableLocalization="false" 
                scanAssembliesForSiteMapNodes="true" 
                skipAssemblyScanOn="" 
                attributesToIgnore="bling,visibility" 
                nodeKeyGenerator="MvcSiteMapProvider.DefaultNodeKeyGenerator, MvcSiteMapProvider" 
                controllerTypeResolver="MvcSiteMapProvider.DefaultControllerTypeResolver, MvcSiteMapProvider" 
                actionMethodParameterResolver="MvcSiteMapProvider.DefaultActionMethodParameterResolver, MvcSiteMapProvider" 
                aclModule="MvcSiteMapProvider.DefaultAclModule, MvcSiteMapProvider" 
                siteMapNodeUrlResolver="MvcSiteMapProvider.DefaultSiteMapNodeUrlResolver, MvcSiteMapProvider" 
                siteMapNodeVisibilityProvider="MvcSiteMapProvider.DefaultSiteMapNodeVisibilityProvider, MvcSiteMapProvider" 
                siteMapProviderEventHandler="MvcSiteMapProvider.DefaultSiteMapProviderEventHandler, MvcSiteMapProvider"/>
    </providers>
</siteMap>

The page uses a main and an administrative area and the sitemap contains nodes for both of those areas, including some DynamicNodes:

<?xml version="1.0" encoding="utf-8" ?>
<mvcSiteMap xmlns="http://mvcsitemap.codeplex.com/schemas/MvcSiteMap-File-3.0" enableLocalization="false">
    <mvcSiteMapNode title="Startseite" controller="Home" action="Index" changeFrequency="Monthly" updatePriority="Normal">
        <!--Main Page-->
        <mvcSiteMapNode title="Produktkatalog" controller="Products" action="Index" >
            <mvcSiteMapNode title="Fahrräder" controller="Bikes" action="List" key="bikes_" >
                <mvcSiteMapNode title="Marken" controller="Bikes" action="List" dynamicNodeProvider="Grauthoff.WebUI.Infrastructure.BikeBrandsDynamicNodeProvider, Grauthoff.WebUI">
                    <mvcSiteMapNode title="Details" controller="Bikes" action="Details" dynamicNodeProvider="Grauthoff.WebUI.Infrastructure.BikeDetailsDynamicNodeProvider, Grauthoff.WebUI" />
                </mvcSiteMapNode>
                <mvcSiteMapNode title="Kategorien" controller="Bikes" action="List" dynamicNodeProvider="Grauthoff.WebUI.Infrastructure.BikeCategoriesDynamicNodeProvider, Grauthoff.WebUI" />
            </mvcSiteMapNode>
            <mvcSiteMapNode title="Absperrpfosten" controller="Barriers" action="List" key="barriers_" >
                <mvcSiteMapNode title="Kategorien" controller="Barriers" action="List" dynamicNodeProvider="Grauthoff.WebUI.Infrastructure.BarrierCategoriesDynamicNodeProvider, Grauthoff.WebUI" />
            </mvcSiteMapNode>
            <mvcSiteMapNode title="Tresore" controller="Safes" action="List" key="safes_" >
                <mvcSiteMapNode title="Marken" controller="Safes" action="List" dynamicNodeProvider="Grauthoff.WebUI.Infrastructure.SafeBrandsDynamicNodeProvider, Grauthoff.WebUI">
                    <mvcSiteMapNode title="Details" controller="Safes" action="Details" dynamicNodeProvider="Grauthoff.WebUI.Infrastructure.SafeDetailsDynamicNodeProvider, Grauthoff.WebUI" />
                </mvcSiteMapNode>
                <mvcSiteMapNode title="Kategorien" controller="Safes" action="List" dynamicNodeProvider="Grauthoff.WebUI.Infrastructure.SafeCategoriesDynamicNodeProvider, Grauthoff.WebUI" />
            </mvcSiteMapNode>
        </mvcSiteMapNode>
        <mvcSiteMapNode title="Marken" controller="Brands" action="Index" />
        [...]
        <!--Admin Area-->
        <mvcSiteMapNode title="Start" controller="Home" action="Index" area="Admin"  />
            [...]    
</mvcSiteMap>

In the main page, I am using

<%: Html.MvcSiteMap().Menu(false) %>

to render the page navigation, using the following DisplayTemplate:

<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl`1[ [MvcSiteMapProvider.Web.Html.Models.MenuHelperModel,MvcSiteMapProvider] ]" %>

<%--this controls the output of the main navigation bar on the main page--%>
<ul id="MainNav">
<% foreach (var node in Model.Nodes) { %>
    <%--skip AdminArea nodes--%>
    <% if (node.Area.Equals("Admin")) { %>    
        <% continue; %>
    <% } %>
    <%--hightlight active node using a CSS class--%>
    <% if (node.IsCurrentNode || node.IsInCurrentPath || (SiteMap.CurrentNode != null && SiteMap.CurrentNode.Url.Equals(node.Url)))
       { %>    
        <li class="naviActive"><%=Html.DisplayFor(m => node)%>
    <% } %>
    <% else { %>
        <li class="naviInactive"><%=Html.DisplayFor(m => node)%>
    <% } %>   
    </li>
<% } %>
</ul>

Generally everything works fine but I have one big showstopper-kind-of problem that I couldn’t solve yet:
If I open one of the DynamicNode related sites in the browser and just stay idle for several minutes (or if I rebuild the solution in VS in the background) and then refresh the page in the browser, I always get a System.NullReferenceException with the following source error and stacktrace:

Zeile 29:                 <div id="navi">
Zeile 30:                     <%--Navigation--%>
Zeile 31:                     <%: Html.MvcSiteMap().Menu(false)%>
Zeile 32:                 </div>
Zeile 33:             </div>

[NullReferenceException: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.]
   MvcSiteMapProvider.DefaultSiteMapProvider.GetSiteMapNodeFromXmlElement(XElement node, SiteMapNode parentNode) in D:\Downloads\smp\Main\src\MvcSiteMapProvider\MvcSiteMapProvider\DefaultSiteMapProvider.cs:1348
   MvcSiteMapProvider.DefaultSiteMapProvider.BuildSiteMap() in D:\Downloads\smp\Main\src\MvcSiteMapProvider\MvcSiteMapProvider\DefaultSiteMapProvider.cs:483

[MvcSiteMapException: An error occured while building the sitemap... Check the InnerException for more details.]
   MvcSiteMapProvider.DefaultSiteMapProvider.BuildSiteMap() in D:\Downloads\smp\Main\src\MvcSiteMapProvider\MvcSiteMapProvider\DefaultSiteMapProvider.cs:563
   MvcSiteMapProvider.DefaultSiteMapProvider.GetRootNodeCore() in D:\Downloads\smp\Main\src\MvcSiteMapProvider\MvcSiteMapProvider\DefaultSiteMapProvider.cs:131
   MvcSiteMapProvider.DefaultSiteMapProvider.get_RootNode() in D:\Downloads\smp\Main\src\MvcSiteMapProvider\MvcSiteMapProvider\DefaultSiteMapProvider.cs:103
   MvcSiteMapProvider.Web.Html.MenuHelper.Menu(MvcSiteMapHtmlHelper helper, Boolean showStartingNode) in D:\Downloads\smp\Main\src\MvcSiteMapProvider\MvcSiteMapProvider\Web\Html\MenuHelper.cs:45
   ASP.views_shared_site_master.__Render__control1(HtmlTextWriter __w, Control parameterContainer) in d:\inetpub\vhosts\grauthoff-shop.de\httpdocs\Views\Shared\Site.Master:31
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +109
   System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
   System.Web.UI.Control.Render(HtmlTextWriter writer) +10
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +208
   System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
   System.Web.UI.Page.Render(HtmlTextWriter writer) +29
   System.Web.Mvc.ViewPage.Render(HtmlTextWriter writer) +43
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3060

This happens both in Debug and in Release mode and even on my remote webserver. Obviously, this prevents me from publishing the project. Since I don’t have the slightest idea what might cause this, I am extremly thankful for any help!

€dit 01.06.2011: I was previously using the 3.1.0 RC release assembly but now attached the 3.1.0 SVN branch to my project to be able to debug the exception. I found out that the exception occurs in the method

protected MvcSiteMapNode
GetSiteMapNodeFromXmlElement(XElement
node, SiteMapNode parentNode)

in the follwing lines where defaultValue.Value is null (siteMapNode and defaultValue aren’t null):

Line 1379: if (siteMapNode[defaultValue.Key] == null)
Line 1380: {
Line 1381:     siteMapNode[defaultValue.Key] = defaultValue.Value.ToString();
Line 1382: }

I also found out that once the error occured, one can’t request the underlying controller action again – not by refreshing the page in the browser and not by opening a new browser window or tab. You first have to request an action that has the URL of a non-dynamic node on an upper level in the sitemap hierarchy and then you can request the dynamic child node again. It almost seems like a caching problem or like some sitemap object is destroyed by the GC and then doesn’t get recreated properly.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T20:15:12+00:00Added an answer on May 22, 2026 at 8:15 pm

    This should be fixed with the 3.1 release. If not, please post a bug on the CodePlex site.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using ASP.NET MVC when trying to get the information stored on my Session[objectName] from
When using ASP.NET MVC plus Entity Framework, and trying to implement a generic repository
i am using asp.net mvc 3. in one my of page. i need to
Using Asp.Net-MVC music store tutorial, concrete page is at : http://www.asp.net/mvc/tutorials/mvc-music-store-part-3 <ul> @foreach (var
using ASP.NET MVC 2 I have a navigation menu inside my Master Page. In
Using ASP.NET MVC and Entity Framework, I encounter some attach/detach errors when I need
I am using ASP.NET-MVC and nHibernate for the first time. Great tools, but big
I'm using ASP.NET MVC 3 to build an application, but i'm having a problem
I'm using ASP.NET MVC 3 with Entity Framework 4. When a user logs in,
Using ASP.NET MVC 3 with C# I have a web page to display a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.