I need to switch between two sitemaps within a VS2005 web application website.
In my web.config file I have:
<siteMap defaultProvider="XmlSiteMapProvider">
<providers>
<add
name="AdminSiteMap"
type="System.Web.XmlSiteMapProvider"
siteMapFile="~/Master/Admin.sitemap" />
<add
name="UserSiteMap"
type="System.Web.XmlSiteMapProvider"
siteMapFile="~/Master/User.sitemap" />
</providers>
</siteMap>
Both Admin.sitemap and User.sitemap are valid XML files (as proved by opening them in IE6).
When I run the the site, I got:
Configuration Error
Description:
An error occurred during the processing of a configuration file required to
service this request. Please review the specific error details below and modify
your configuration file appropriately.
Parser Error Message: The
provider 'XmlSiteMapProvider' specified for the defaultProvider does not exist
in the providers collection.
Source Error:
Line 25: --> Line 26: <!-- --> Line 27: <siteMap defaultProvider="XmlSiteMapProvider"> Line 28: <providers> Line 29: <add |
Source File:
C:\XXXXXXXXXXXXX\web.config Line: 27
If I comment out the <site Map .../> block, the the starts with its default Web.sitemap with the default menu displayed correctly. I cannot readily use the ASP.NET 2.0 User/Role model as the system architecture is to use web service data access. Since XmlSiteMapProvider is the default source, why is it not being found?
Changing
<siteMap defaultProvider="XmlSiteMapProvider">
to
<siteMap>
fixed the problem! Why should removing the reference to the provider fix the problem?
Don't forget to click "Mark as Answer" on the post that helped you.
This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.