It's driving me nuts. I've searched and tried and searched and tried ... now I ask for your help!
I have an asp:menu control that uses a sitemap. Once the user is authenticated, I want to dynamically change the site map from code behind (c#). Here's the pertinent lines of code:
Site.Master:
<asp:Menu ID="aspMenu" runat="server" StaticDisplayLevels="1" DataSourceID="SiteMapDataSource1" Orientation="Horizontal" StaticEnableDefaultPopOutImage="False">
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" ShowStartingNode="False"
StartFromCurrentNode="False" StartingNodeOffset="0" />
web.config:
<siteMap defaultProvider="WebSitemap" >
<providers>
<add name="WebSitemap" type="System.Web.XmlSiteMapProvider" siteMapFile="Web.sitemap"/>
<add name="MemberSiteMap" type="System.Web.XmlSiteMapProvider" siteMapFile="Member.sitemap"/>
</providers>
</siteMap>
Site.Master.cs:
protected override void OnPreRender(System.EventArgs e)
{
if (Request.IsAuthenticated)
{
SiteMapDataSource1.SiteMapProvider = "MemberSitemap";
}
}
After a successful build (VS 2010, 4.0 framework) I get the following error after a login:
Server Error in '/' Application. The SiteMapProvider 'MemberSitemap' cannot be found.
What am I doing wrong? Thanks .... Bob
Duh, had the siteMap providers in the wrong section of web.config. I don't recommend web.config on sleep deprivation.