newbie: problems with SiteMapProviders

J

Jeff

hey

asp.net 2.0

My problem is that no matter what SiteMapProvider I specify in the code, it
always uses defaultProvider SiteMapProvider. In other words if I make these
changes to the SiteMapDataSource1:
<siteMap defaultProvider="Anonymous">
The menu which is based on this SiteMapProvider get menu items from the
Anoymous SiteMapProvider... But SiteMapDataSource1.SiteMapProvider is set to
"LoggedIn"

<siteMap defaultProvider="LoggedIn">
<providers>
<add name="LoggedIn" type="System.Web.XmlSiteMapProvider"
siteMapFile="LoggedIn.sitemap"/>
<add name="Anonymous" type="System.Web.XmlSiteMapProvider"
siteMapFile="Anonymous.sitemap"/>
</providers>
</siteMap>

<LoggedInTemplate>
<asp:Menu ID="mnuHeader" runat="server" BackColor="#F7F6F3"
DataSourceID="SiteMapDataSource1"
DynamicHorizontalOffset="2" Font-Names="Verdana" Font-Size="0.8em"
ForeColor="#7C6F57"
MaximumDynamicDisplayLevels="0" Orientation="Horizontal"
StaticDisplayLevels="2"
StaticSubMenuIndent="10px" Style="z-index: 100; left: 0px; position:
absolute;
top: 0px" OnMenuItemClick="mnuHeader_MenuItemClick" Width="900px">
<StaticMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px"
/>
<DynamicHoverStyle BackColor="#7C6F57" ForeColor="White" />
<DynamicMenuStyle BackColor="#F7F6F3" />
<StaticSelectedStyle BackColor="#5D7B9D" />
<DynamicSelectedStyle BackColor="#5D7B9D" />
<DynamicMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px"
/>
<StaticHoverStyle BackColor="#7C6F57" ForeColor="White" />
<DataBindings>
<asp:MenuItemBinding DataMember="SiteMapNode"
NavigateUrlField="Url" TextField="Title" />
</DataBindings>
</asp:Menu>
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server"
SiteMapProvider="LoggedIn" />
</LoggedInTemplate>

I even tryed this example:
http://msdn2.microsoft.com/en-us/library/ms178426(d=ide).aspx :
<siteMap defaultProvider="XmlSiteMapProvider">
<providers>
<add name="LoggedIn" type="System.Web.XmlSiteMapProvider"
siteMapFile="LoggedIn.sitemap"/>
<add name="Anonymous" type="System.Web.XmlSiteMapProvider"
siteMapFile="Anonymous.sitemap"/>
</providers>
</siteMap>

But then I get this error:
Parser Error Message: The provider 'XmlSiteMapProvider' specified for the
defaultProvider does not exist in the providers collection.

If the SiteMapDataSource1.SiteMapProvider is set to "LoggedIn", then I want
it to use the "LoggedIn" SiteMapProvider, not use what is specified as the
defaultProvider.

Any suggestions on how to solve this are very welcome

Jeff
 
J

Jeff

Jeff said:
hey

asp.net 2.0

My problem is that no matter what SiteMapProvider I specify in the code,
it always uses defaultProvider SiteMapProvider. In other words if I make
these changes to the SiteMapDataSource1:
<siteMap defaultProvider="Anonymous">
The menu which is based on this SiteMapProvider get menu items from the
Anoymous SiteMapProvider... But SiteMapDataSource1.SiteMapProvider is set
to "LoggedIn"

<siteMap defaultProvider="LoggedIn">
<providers>
<add name="LoggedIn" type="System.Web.XmlSiteMapProvider"
siteMapFile="LoggedIn.sitemap"/>
<add name="Anonymous" type="System.Web.XmlSiteMapProvider"
siteMapFile="Anonymous.sitemap"/>
</providers>
</siteMap>

<LoggedInTemplate>
<asp:Menu ID="mnuHeader" runat="server" BackColor="#F7F6F3"
DataSourceID="SiteMapDataSource1"
DynamicHorizontalOffset="2" Font-Names="Verdana" Font-Size="0.8em"
ForeColor="#7C6F57"
MaximumDynamicDisplayLevels="0" Orientation="Horizontal"
StaticDisplayLevels="2"
StaticSubMenuIndent="10px" Style="z-index: 100; left: 0px;
position: absolute;
top: 0px" OnMenuItemClick="mnuHeader_MenuItemClick" Width="900px">
<StaticMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px"
/>
<DynamicHoverStyle BackColor="#7C6F57" ForeColor="White" />
<DynamicMenuStyle BackColor="#F7F6F3" />
<StaticSelectedStyle BackColor="#5D7B9D" />
<DynamicSelectedStyle BackColor="#5D7B9D" />
<DynamicMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px"
/>
<StaticHoverStyle BackColor="#7C6F57" ForeColor="White" />
<DataBindings>
<asp:MenuItemBinding DataMember="SiteMapNode"
NavigateUrlField="Url" TextField="Title" />
</DataBindings>
</asp:Menu>
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server"
SiteMapProvider="LoggedIn" />
</LoggedInTemplate>

I even tryed this example:
http://msdn2.microsoft.com/en-us/library/ms178426(d=ide).aspx :
<siteMap defaultProvider="XmlSiteMapProvider">
<providers>
<add name="LoggedIn" type="System.Web.XmlSiteMapProvider"
siteMapFile="LoggedIn.sitemap"/>
<add name="Anonymous" type="System.Web.XmlSiteMapProvider"
siteMapFile="Anonymous.sitemap"/>
</providers>
</siteMap>

But then I get this error:
Parser Error Message: The provider 'XmlSiteMapProvider' specified for the
defaultProvider does not exist in the providers collection.

If the SiteMapDataSource1.SiteMapProvider is set to "LoggedIn", then I
want it to use the "LoggedIn" SiteMapProvider, not use what is specified
as the defaultProvider.

Any suggestions on how to solve this are very welcome

Jeff
 
J

Jeff

It was my own mistake, doing modification to the wrong master page. I have 3
master pages in my project: Frontpage.master, MasterPage.master and
ContentMaster.master. MasterPage and ContentMaster are very similar but
MasterPage isn't used in the project. So here I accidently did modifications
to MasterPage and wondered why I didn't see the changes when I tested the
web portal..... But after a while I discovered that it was the ContentMaster
I used....

I also have to add that I made some modifications to the SiteMapProvider
settings in web.config:
<siteMap defaultProvider="AspNetXmlSiteMapProvider">
<providers>
<add name="LoggedIn" type="System.Web.XmlSiteMapProvider"
siteMapFile="LoggedIn.sitemap"/>
<add name="Anonymous" type="System.Web.XmlSiteMapProvider"
siteMapFile="Anonymous.sitemap"/>
</providers>
</siteMap>

Previously I used "LoggedIn" or "Anonymous" as defaultProvider. Then I read
that defaultProvider had to be something else if it was going to work. So I
tryed "AspLoggedIn", because I've seen in a example where someone used
"AspNetXmlSiteMapProvider".. But that didn't work... But then I tryed using
"AspNetXmlSiteMapProvider" and it works now
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,153
Members
46,699
Latest member
AnneRosen

Latest Threads

Top