This project is read-only.

How to Add Submenu Pages to the Administration Menu

Topics: Developer Forum, Localization Forum, Project Management Forum, User Forum
Oct 30, 2009 at 7:56 PM

I would like to add additional submenu pages to the Administration Menu of my site that can only be viewed and accessed with Admin permissions.  Please advise  how this can be accomplished and where in the code I need to make the menu changes.

Nov 2, 2009 at 9:27 AM

When it a one-time-only requirement and after you created a new site, you can manual modify the "Web.sitemap" located in the App_Data folder.

E.g. (in dutch version)

<siteMap xmlns="">
    <siteMapNode url="~/administration/default.aspx" title="Beheer">
      <siteMapNode url="~/administration/website.aspx" title="CMS Instellingen" />
      <siteMapNode url="~/administration/sections.aspx" title="Onderdelen/Pagina verwijzingen" />
      <siteMapNode url="~/administration/navigation.aspx" title="Pagina's en Navigatie" />
      <siteMapNode url="~/administration/users.aspx" title="Gebruikersbeheer" />
=> <siteMapNode url="~/administration/mypage.aspx" title="Added my own page" /> </siteMapNode>
When you want to add this for all future new websites, modify the method "createInitialSitemap" in source file "SitemapEditor.cs" located in the App_Code folder.
        /// <summary>
        /// Creates the initial sitemap with all the necessary nodes for the administration-pages
        /// </summary>
        /// <returns>SiteMap as XmlDocument</returns>
        private XmlDocument createInitialSitemap()
            XmlDocument sitemap = new XmlDocument();
            StringBuilder xml = new StringBuilder();
            CultureInfo culture = CultureInfo.CreateSpecificCulture("en-US");

            xml.Append("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
            xml.Append("<siteMap xmlns=\"\">");
            xml.Append("  <siteMapNode>");
            xml.Append("    <siteMapNode url=\"~/administration/default.aspx\" title=\"" + Resources.StringsRes.ResourceManager.GetString("cls_SitemapEditor_Administration",culture) + "\">");
            xml.Append("      <siteMapNode url=\"~/administration/website.aspx\" title=\"" + Resources.StringsRes.ResourceManager.GetString("cls_SitemapEditor_CMSSetup",culture) + "\"/>");
            xml.Append("      <siteMapNode url=\"~/administration/sections.aspx\" title=\"" + Resources.StringsRes.ResourceManager.GetString("cls_SitemapEditor_Sections",culture) + "\"/>");
            xml.Append("      <siteMapNode url=\"~/administration/navigation.aspx\" title=\"" + Resources.StringsRes.ResourceManager.GetString("cls_SitemapEditor_SectionsPages",culture) + "\"/>");
            xml.Append("      <siteMapNode url=\"~/administration/users.aspx\" title=\"" + Resources.StringsRes.ResourceManager.GetString("cls_SitemapEditor_Management", culture) + "\"/>");
=>          xml.Append("      <siteMapNode url=\"~/administration/mypage.aspx\" title=\"Added my own page\"/>");
xml.Append(" </siteMapNode>"); xml.Append(" </siteMapNode>"); xml.Append("</siteMap>"); sitemap.LoadXml(xml.ToString()); return sitemap; }
In both cases be sure you also add the physical file (e.g. /administration/mypage.aspx)

Good luck,