asp.netsecuritysitemapweb.sitemap

How to use 'securityTrimmingEnabled' attribute


I have an application with security configuration and roles are created for the same application.i want to set visibility of the menu item on role basis.I have used following code to achieve this In Web.sitemap

<siteMapNode url="" title=""  description="" >
    <siteMapNode url="~/Account/Default.aspx" title="Change Password"  description=""  securityTrimmingEnabled="true"/>
    <siteMapNode url="~/Account/ChangePasswordSuccess.aspx" title="Welcome"  description="" />
    <siteMapNode url="~/Account/Demo.aspx" title="Demo"  description="" />
</siteMapNode>

In web.config

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

while running the application and login into website i got error like *Unrecognized attribute 'securityTrimmingEnabled'. Note that attribute names are case-sensitive. * This error again repeating even i remove it from web.config.Can you look over this and tell me where i went wrong.


Solution

  • Its done simply by removing securityTrimmingEnabled="true in the sitemap file.