AmanoGinji63
AmanoGinji63

Reputation: 11

XmlSiteMapProvider only parse the first node

I have an annoying problem and i can't find any start of a solution, so i hope you can help me.

I have a sitemap with roles defined for each node :

<?xml version="1.0" encoding="utf-8"?>
<siteMap enableLocalization="true">
  <siteMapNode title="" url="" roles="">
    <siteMapNode title="default" url="~/Default.aspx" roles="user" />
    <siteMapNode title="supervision" url="~/EcranSupervision.aspx" roles="Admin" />
    <siteMapNode title="exploitation" url="~/ChaineTraitementList.aspx" roles="Admin" />
  </siteMapNode>
</siteMap>

And in my web.config, i enable security and i use a custom provider :

<siteMap defaultProvider="MainMenuSitemap">
      <providers>
        <add name="MainMenuSitemap" type="UbiXmlSiteMapProvider" siteMapFile="Web.sitemap" securityTrimmingEnabled="true" />
      </providers>
    </siteMap>

In my provider, i only override IsAccessibleToUser to do my logic :

public class UbiXmlSiteMapProvider : XmlSiteMapProvider
    {
        public override bool IsAccessibleToUser(HttpContext context, SiteMapNode node)
        {
            // custom logic here
        }
    }

My problem is that the node used in IsAccessibleToUser is always the one with the url "Default.aspx". So if I have the role to see it, all the nodes are shown and if i don't have the role, none of the nodes are shown.

I don't understand what is wrong here.

Do you have a hint for me ?

Upvotes: 1

Views: 134

Answers (0)

Related Questions