0

I'm using VWD 2010, ASP.NET with C#. I found a pointer for how to do this in another SO post. Unfortunately, I can't get it working.

The sample code it points to is here: http://weblogs.asp.net/jgaylord/adding-querystring-parameters-to-the-sitemapnode

I have included the C# code for this, but I can't seem to get the program to recognize that the code is actually there. I set break points that never get invoked.
I put this into the web.config:

    <siteMap enabled="true">
      <providers>
        <clear/>
        <add name="ExtendedSiteMapProvider" type="Configuration.ExtendedSiteMapProvider" siteMapFile="web.sitemap" securityTrimmingEnabled="true" />
<!--
        <add siteMapFile="Web.sitemap" name="AspNetXmlSiteMapProvider" type="System.Web.XmlSiteMapProvider" securityTrimmingEnabled="true"/>
    -->    
      </providers>
    </siteMap>

Notice how AspNetXmlSiteMapProvider is commented out. That name appears nowhere else in the file. Nevertheless when I attempt to run my program, I get this error message: The provider 'AspNetXmlSiteMapProvider' specified for the defaultProvider does not exist in the providers collection.

If I uncomment that line, the program runs, but the new code is never invoked. Any ideas?

elbillaf
  • 1,952
  • 10
  • 37
  • 73

1 Answers1

1

That's because you are not specifying the defaultProvider which defaults exactly to AspNetXmlSiteMapProvide, like you can see here.

So you just have to specify the defualt provider like this:

<siteMap enabled="true" defaultProvider="ExtendedSiteMapProvider">
  <providers>
    ....
  </providers>
</siteMap>

Or specify the provider in corresponding SiteMpaDataSource property, so that the default isn't used.

JotaBe
  • 38,030
  • 8
  • 98
  • 117
  • You have solved that problem. I have a follow-on question, but I'm not sure whether I should open another question. My problem now is that ExtendedSiteMapProvider does not seem to be invoked. I have breakpoints defined, but they never break. In any case, thanks! – elbillaf Jun 26 '14 at 17:38
  • I think you should add a different question, explaining the new situation. Please, add there relevant code that shows the config, a little bit of the provider implementation, and the control which uses it (ASP.NET navigation control: breadcrumb, menu, tree...). It's clear the problem is now somewhere else. – JotaBe Jun 26 '14 at 17:40