newbie45
newbie45

Reputation: 11

asp.net more than one sitemap

I am having an issue with the sitemap control, I have added the hierarchical levels within the web.sitemap file and added the sitemap control to the various masterpages. I have however two homepages which can be viewed depending on the user of the system.

Is there any way to define two sitemap structures within this web.sitemap file or can I just create another sitemap file?

I am getting

Home > Home > View Details

Instead of

Home > View Details (for my first user)

Thanks

Upvotes: 1

Views: 450

Answers (1)

Yes you can define two sitemap structures by creating a seperate sitemap file. Once your sitemaps have been created, all you need todo is to state them within your Web.Config file like so:

<siteMap>
  <providers>
    <add name="Homepage1" type="System.Web.XmlSiteMapProvider" siteMapFile="~/Homepage1.sitemap" />
    <add name="Homepage2" type="System.Web.XmlSiteMapProvider" siteMapFile="~/Homepage2.sitemap" />
  </providers>      
</siteMap>

Then you can choose which sitemap you want to choose by using the SiteMapDataSource control:

<asp:SiteMapDataSource ID="SitemapDS" runat="server" ShowStartingNode="false" SiteMapProvider="Homepage1" />

Hope this helps.

Upvotes: 2

Related Questions