Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
110
How to make different Menus
posted

Hello,

I am using Asp.Net MVC platform to develop my web site. On Site.Master I added WebDataMenu and add there couple items. How no make Item Admin visible only if user is authorized.

Thanks

  • 75
    Verified Answer
    posted

    Hi ksv510,

    you can use XmlSiteMapProvider for DataSource and you can enable securityTrimmingEnabled="true"

    <siteMap enabled="true" defaultProvider="XmlSiteMapProvider">
          <providers>
            <clear/>
            <add siteMapFile="Web.sitemap" name="XmlSiteMapProvider" 
    type="System.Web.XmlSiteMapProvider" securityTrimmingEnabled="true"/>
          </providers>
        </siteMap>

     and in your sitemap you can define roles for each menu item 

    <?xml version="1.0" encoding="utf-8" ?>
    <siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
      <siteMapNode url="" title="Menu"  description="">
        <siteMapNode url="www.infragistics.com1" title="Admin1"  
    description="" roles="Administrator"/>
        <siteMapNode url="www.infragistics.com2" title="Admin2"  
    description="" roles="Administrator" />

        <siteMapNode url="http://community.infragistics.com/1" title="User"  
    description="" />
        <siteMapNode url="http://community.infragistics.com/2" title="User"  
    description="" />
      </siteMapNode>
    </siteMap>

    Georgi