Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Problem with MvcSiteMapProvider and dynamicNodeProvider

Hi I have add the provider in my web config as below:

 <add name="MvcSiteMapProvider"
             type="MvcSiteMapProvider.DefaultSiteMapProvider, MvcSiteMapProvider"
             siteMapFile="~/Sitemap/SiteMap.sitemap"
             securityTrimmingEnabled="true"

             enableLocalization="true"
             scanAssembliesForSiteMapNodes="true"
             skipAssemblyScanOn=""
             attributesToIgnore="bling"
             nodeKeyGenerator="MvcSiteMapProvider.DefaultNodeKeyGenerator, MvcSiteMapProvider"
             controllerTypeResolver="MvcSiteMapProvider.DefaultControllerTypeResolver, MvcSiteMapProvider"
             actionMethodParameterResolver="MvcSiteMapProvider.DefaultActionMethodParameterResolver, MvcSiteMapProvider"
             aclModule="MvcSiteMapProvider.DefaultAclModule, MvcSiteMapProvider"
             siteMapNodeUrlResolver="MvcSiteMapProvider.DefaultSiteMapNodeUrlResolver, MvcSiteMapProvider"
             siteMapNodeVisibilityProvider="MvcSiteMapProvider.DefaultSiteMapNodeVisibilityProvider, MvcSiteMapProvider"

And here is my .sitemap file

<?xml version="1.0" encoding="utf-8" ?>
<mvcSiteMap xmlns="http://mvcsitemap.codeplex.com/schemas/MvcSiteMap-File-2.0" enableLocalization="true">

    <mvcSiteMapNode title="Classifieds" controller="Classifieds" action="Index"  changeFrequency="Always" updatePriority="Normal">
        <mvcSiteMapNode title="Category" controller="Classifieds" action="ClassifiedSelection"  dynamicNodeProvider="MySite.Helpers.ClassifiedCatDynamicNodeProvider, MySite.Helpers" >
          <mvcSiteMapNode title="SpecificAd" controller="Classifieds" action="SpecificClassified" dynamicNodeProvider="MySite.Helpers.ClassifiedAdsDynamicNodeProvider, MySite.Helpers" >
            <mvcSiteMapNode title="Email Seller" controller="Classifieds" action="EmailSeller" />

        </mvcSiteMapNode>
      </mvcSiteMapNode>
    </mvcSiteMapNode>

</mvcSiteMap>

I have create two dynamic prodiders in a seperate class file- Mine a basiclly the same. (as shown here http://mvcsitemap.codeplex.com/wikipage?title=Dynamic%20sitemaps&version=1)

I can't get the sitemap to work at all i get a value can not be null error whenever I load the page with the sitemap.

Please help, I though that the MvcSitemap would call my dynamicNodeprovider but it isn't as no beakpoints are being it in any of my two classes that I have made,

Please Help.

like image 641
SimonGates Avatar asked Jan 22 '23 10:01

SimonGates


1 Answers

I had this problem too, to fix it, I had to change the second part of the dynamicNodeProvider parameter to the project assembly name (this is found in Visual Studio by choosing your project, then right click -> properties, application tab.

In your case it is probably

dynamicNodeProvider="MySite.Helpers.ClassifiedCatDynamicNodeProvider, MySite"
like image 165
moonpatrol Avatar answered Jan 28 '23 07:01

moonpatrol