C# Sql SiteMap Provider security Trimming not working

csecurity-trimmingsitemapsql

While I was using web.sitemap the security Trimming on my menu was working fine.
Now that I have switched to a Sql Site Map Provider, the security trimming just stopped working.

        <siteMap enabled="true" defaultProvider="AspNetSqlSiteMapProvider">
        <providers>
            <add name="AspNetSqlSiteMapProvider" type="SqlSiteMapProvider" securityTrimmingEnabled="true" connectionStringName="SiteMapConnectionString" sqlCacheDependency="SiteMapDatabase:SiteMap"/>
        </providers>
    </siteMap>

I have had to edit the proc_GetSiteMap to return my menu items in the correct sort order, but it returns all the relevant data from the sitemap table (including the roles).

Any help would be apreciated.

Best Answer

Have you restricted access to the folders that should be restricted with a web.config file.

for example:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <system.web>
        <authorization>
          <allow roles="Administrator" />
          <deny roles="user"/>
        </authorization>
    </system.web>
</configuration>

while searching found a link you may also have a look at it: http://www.mytakeon.net/post/2006/09/The-SQL-SiteMap-Provider-and-trimming-by-roles-%28originally-posted-2006-09-20%29.aspx

Related Topic