In this example, the node "Admin Area" only show if the user in on Admin role. But the node Page 3 shows everytime, if the user is or is not on Manager role.
BUT, if I put that node inside another node, it is filtered ok. Like this:
Yes you can, do you have the sitemap defined in the web.config?
Like:
<siteMap defaultProvider="XmlSiteMapProvider" enabled="true">
<providers>
<add name="XmlSiteMapProvider"
description="SiteMap provider which reads in .sitemap XML files."
type="System.Web.XmlSiteMapProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
siteMapFile="web.sitemap"
securityTrimmingEnabled="true"/>
</providers>
</siteMap>
The securityTrimmingEnabled="true" is the important bit.
Regards
Jeremy
If this has helped Please: Don't forget to click "Mark as Answer" on the post that helped you.
That way future readers will know which post solved your issue.
Regards
Jeremy
If this has helped Please: Don't forget to click "Mark as Answer" on the post that helped you.
That way future readers will know which post solved your issue.
cseven
Member
23 Points
139 Posts
Roles & SiteMap
Nov 02, 2007 03:35 PM|LINK
Hi!
I have a Menu Control wich DataSource is a SiteMap. The nodes should only appear if the user is on the specified role (on node role property).
But, I'm having some problems doing this. The nodes are only being filtered if they are inside of another node.
This is my SiteMap:
2 <siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
3
4 <siteMapNode title="Home" url="Home.aspx" roles="*">
5 <siteMapNode url="Page1.aspx" title="Page 1" roles="*" />
6 <siteMapNode url="Page2.aspx" title="Page 2" roles="*" />
7 <siteMapNode url="Page3.aspx" title="Page 3" roles="Manager" />
8 <siteMapNode title="Admin Area" roles="Admin">
9 <siteMapNode url="Admin/Page1.aspx" title="Admin Page 1" />
10 <siteMapNode url="Admin/Page2.aspx" title="Admin Page 1" />
11 </siteMapNode>
12 </siteMapNode>
13 </siteMap>
In this example, the node "Admin Area" only show if the user in on Admin role. But the node Page 3 shows everytime, if the user is or is not on Manager role.
BUT, if I put that node inside another node, it is filtered ok. Like this:
mohi88
Contributor
3752 Points
734 Posts
Re: Roles & SiteMap
Nov 02, 2007 04:05 PM|LINK
Multiple roles can be specified using commas or semicolons as separators.
check between lines in this site
MCSD.NET
My Blog ||My Tweets ||My Photos ||LinkedIn
cseven
Member
23 Points
139 Posts
Re: Roles & SiteMap
Nov 02, 2007 05:31 PM|LINK
Thanks, but that's not my problem.
I've edited the firts post, maybe now someone can understand what is happening.
mohi88
Contributor
3752 Points
734 Posts
Re: Roles & SiteMap
Nov 03, 2007 08:38 AM|LINK
1 <siteMapNode title="Manager page" roles="Manager" />
2 <siteMapNode url="Page3.aspx" title="Page 3" />
3 </siteMapNode>
here you are grouping the the pages under one role. and that means that page3 can be only entered by users with admin roles like the manager page.
MCSD.NET
My Blog ||My Tweets ||My Photos ||LinkedIn
cseven
Member
23 Points
139 Posts
Re: Roles & SiteMap
Nov 05, 2007 10:00 AM|LINK
But can't I do the same without having that page in a group of nodes?
Just:
<siteMapNode url="Page3.aspx" title="Page 3" roles="Manager" />
cseven
Member
23 Points
139 Posts
Re: Roles & SiteMap
Nov 07, 2007 05:07 PM|LINK
Anyone?
jtawja
Member
2 Points
6 Posts
Re: Roles & SiteMap
Nov 07, 2007 10:42 PM|LINK
Have you figured this one out yet??? I have ran into the same problem.
cseven
Member
23 Points
139 Posts
Re: Roles & SiteMap
Nov 08, 2007 08:39 AM|LINK
Nop, nothing.. [:S]
It's strange, because I believe this should work. So, maybe I'm doing something wrong, but I don't know what..
jeremyh
Star
8173 Points
1477 Posts
Re: Roles & SiteMap
Nov 08, 2007 09:17 AM|LINK
Yes you can, do you have the sitemap defined in the web.config?
Like:
<siteMap defaultProvider="XmlSiteMapProvider" enabled="true"> <providers> <add name="XmlSiteMapProvider" description="SiteMap provider which reads in .sitemap XML files." type="System.Web.XmlSiteMapProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" siteMapFile="web.sitemap" securityTrimmingEnabled="true"/> </providers> </siteMap>The securityTrimmingEnabled="true" is the important bit.Jeremy
If this has helped Please: Don't forget to click "Mark as Answer" on the post that helped you.
That way future readers will know which post solved your issue.
jeremyh
Star
8173 Points
1477 Posts
Re: Roles & SiteMap
Nov 08, 2007 09:24 AM|LINK
Oh forgot to say before check that you have the permission setup for the directory in the web.config
<location path="Page3.aspx">
<system.web>
<authorization>
<allow roles="Manager" />
</authorization
</system.web>
</location>
Hope it helps
Jeremy
If this has helped Please: Don't forget to click "Mark as Answer" on the post that helped you.
That way future readers will know which post solved your issue.