Multiple sitemaps

Oct 25, 2009 at 12:52 PM

Hi again!

In my website project i have the requirement for the following structure:

-----------------------------------------------

               TOP MENU

-----------------------------------------------

LEFT MENU|             Content pages

                 |

                 |

                 |

The top menu should be accessible to everybody!

The left menu should be accessible to only those people which have logged in.

I think that i have to declare 2 sitemaps: one for the top menu and one for the left menu. Is this correct?

If yes how do i reference in site.master these 2 different sitemaps using Html.Menu (or asp:menu)?

 

Thanks in advance

Oct 25, 2009 at 2:49 PM

As with everything in life...answers come immediately after expressing a question, i will answer my own question:

Yes we can define 2 or more sitemaps which have different names. These names are then used in the HTML.Menu method to

access the sitemapprovider. e.g.:

in web.config (under sitemap/providers) we have the definition for the 2 sitemaps

<add name="MvcSiteMap"
             type="MvcSiteMap.Core.MvcSiteMapProvider"
             siteMapFile="~/Web.Sitemap"
             securityTrimmingEnabled="true"
             cacheDuration="10"/>
<add name="MvcSiteMap2"
             type="MvcSiteMap.Core.MvcSiteMapProvider"
             siteMapFile="~/Web2.Sitemap"
             securityTrimmingEnabled="true"
             cacheDuration="10"/>

This means we have (prior to the above) inserted into out project 2 sitemap files with the corresponding names Web.Sitemap and Web2.Sitemap.

After the above steps we can use site.master file to insert e.g. the following code snippets:

.... <%=Html.Menu("MvcSiteMap", "sf-menu", "")%>...   (i'm using superfish that's why i use "sf-menu",  but you can leave it empty)

and  somewhere  else

... <%=Html.Menu("MvcSiteMap2", "sf-menu", "")%>

As you can see it's fairly easy to use...

Cheers