locked
Hide/Disable SiteMapNode from Administrator RRS feed

  • Question

  • User-1846870001 posted

    Is it possible to hide/disable a sitemapnode from an Administrator? Meaning that once the admin logs into the site, they are presented with only the sitemapnodes that are relevant to an admin, and they are not cluttered with all of the "public" sitemapnode links. Any help would be appreciated.

    Friday, November 14, 2008 10:02 AM

All replies

  • User535082756 posted

    hi

    create an xml file based on the login and map that particular xml to the sitemap control

    refer this link and see whether it will be usefull

    http://aspnet.4guysfromrolla.com/articles/111605-1.aspx

    or use and xmldatasource and try it with sitemap. This is just an idea. Hope this helps/

    thanks

    Friday, November 14, 2008 12:02 PM
  • User-1846870001 posted

     We currently have a web.sitemap xml file that I will show below. What we are trying to do is only allow the administrator to view sitemapnodes that are set to roles="Administrators". I know that we can disable certain nodes for all users except the Administrator, but is there a way to ENABLE all nodes for all users EXCEPT the administrator?

    Here is our sitemap:

     <?xml version="1.0" encoding="utf-8" ?>
    <siteMap>
        <siteMapNode url="default.aspx" title="Home"  description="">
            <siteMapNode url="~/" title="Home"  roles="*"/>
            <siteMapNode url="AboutUs.aspx" title="About Us"  roles="*"/>
            <siteMapNode url="WhyUs.aspx" title="Why Us?"  roles="*" />
            <siteMapNode url="RequestInfo.aspx" title="Request Info"  roles="*"/>
            <siteMapNode url="ContactUs.aspx" title="Contact Us" roles="*" />
            <siteMapNode url="PostAd.aspx" title="Post an Ad"  roles="Administrators"/>
            <siteMapNode url="MyAds.aspx" title="My Ads &amp; Profile" roles="Administrators">
                <siteMapNode url="MyProfile.aspx" title="My Profile" roles="Administrators" />
                <siteMapNode url="Login.aspx" title="Login" roles="*" />
                <siteMapNode url="Register.aspx" title="Create an Account" roles="Administrators" />
            </siteMapNode>
            <siteMapNode url="Admin/" title="Site Administration" roles="Administrators">
                <siteMapNode url="Admin/Settings.aspx" title="My Profile" roles="Administrators" />
            </siteMapNode>
        </siteMapNode>
    </siteMap>

    Friday, November 14, 2008 12:31 PM
  • User-1846870001 posted

     Also if it helps, we are using an asp:repeater for the navigaion:

    <asp:Repeater ID="TopMenuRepeater" Runat="server" DataSourceID="SiteMapDataSource">
                        <ItemTemplate>
                            <li>
                            <asp:HyperLink Runat="server" ID="MenuLink" NavigateUrl='<%# Eval("Url") %>'><span><%# Eval("Title") %></span></asp:HyperLink></li>
                        </ItemTemplate>
                    </asp:Repeater>

    Friday, November 14, 2008 12:33 PM
  • User730446648 posted

    I did not try it but in this section

    <?xml version="1.0" encoding="utf-8" ?>
    <siteMap>
        <siteMapNode url="default.aspx" title="Home"  description="">
            <siteMapNode url="~/" title="Home"  roles="*"/>
            <siteMapNode url="AboutUs.aspx" title="About Us"  roles="*"/>
            <siteMapNode url="WhyUs.aspx" title="Why Us?"  roles="*" />
            <siteMapNode url="RequestInfo.aspx" title="Request Info"  roles="*"/>
            <siteMapNode url="ContactUs.aspx" title="Contact Us" roles="*" />
            <siteMapNode url="PostAd.aspx" title="Post an Ad"  roles="Administrators"/>
            <siteMapNode url="MyAds.aspx" title="My Ads &amp; Profile" roles="Administrators">
                <siteMapNode url="MyProfile.aspx" title="My Profile" roles="Administrators" />
                <siteMapNode url="Login.aspx" title="Login" roles="*" />
                <siteMapNode url="Register.aspx" title="Create an Account" roles="Administrators" />
            </siteMapNode>
            <siteMapNode url="Admin/" title="Site Administration" roles="Administrators">
                <siteMapNode url="Admin/Settings.aspx" title="My Profile" roles="Administrators" />
            </siteMapNode>
        </siteMapNode>
    </siteMap>

     

     

    Try changing  * to Guest

    The * is just a wildcard that means everyone.

    Should work.

     

    Friday, November 14, 2008 10:24 PM