i'm trying to set a sitemap based in roles/users.. ( i can't use securitytrimming because the role membership provider, i have it in the server side and it'd be complicated to implement ) so what i'm trying to do is to do it simply after getting the item to remove and do it.
I have a website map defined as:
<siteMapNode title="Gestion des roles" url="" description="Gestion des roles">
<siteMapNode url="~/Membership/AddRole.aspx" title="Ajouter Role" description="Ajouter role" />
<siteMapNode url="~/Membership/DeleteRole.aspx" title="Supprimer Role" description="Supprimer un role" />
</siteMapNode>
<siteMapNode title="Gestion des sites" url="" description="Gestion des sites">
<siteMapNode url="~/Membership/AddSite.aspx" title="Ajouter Site" description="Ajouter un nouveau site" />
</siteMapNode>
the way i'm accessing now is with this code:
Menu menu = (Menu)Master.FindControl("Menu1");
String valuePath = @"Gestions/Gestion/Ajouter";
MenuItem item = menu.FindItem(valuePath);
if (item.Parent != null)
item.Parent.ChildItems.Remove(item);
but after executing the item is null and an exception is thrown. thank you for reading