Multiple Sitemaps


A problem that i found lately was when i needed to have multiple sitemaps. Why? I needed different menus for different parts of the website. Normally, the sitemap must be found at the root of the website. After searching, I found this solution which is very easy to implement… Next are the steps:

1. In web.config, you can add multiple site map providers, and set the siteMapFile property.

    <siteMap defaultProvider=”XmlSiteMapProvider” enabled=”true”>
        <add siteMapFile=”web.sitemap” name=”XmlSiteMapProvider” type=”System.Web.XmlSiteMapProvider” securityTrimmingEnabled=”true”/>

 <add siteMapFile=”my.sitemap” name=”MyXmlSiteMapProvider” type=”System.Web.XmlSiteMapProvider” securityTrimmingEnabled=”true”/>


2 In a page, add a SiteMapDataSource, set the SiteMapProvider to you have configurated in the config file

<asp:SiteMapDataSource ID=”SiteMapDataSource1″ runat=”server” SiteMapProvider=”MyXmlSiteMapProvider” />

3. Bind you treeview or menu control to this datasource control.


2 thoughts on “Multiple Sitemaps

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s