Hmm, I've never seen the attribute roles= in siteMapNode. What I've always done is added to my web.config the proper role for the page and that keeps it from coming out on my web site.
I figure it out, in my web.config I was doing <locationpath="~/Fin/Contas/ImpExtBcoSant.aspx"
> and it was not working. When I change to <locationpath="Fin/Contas/ImpExtBcoSant.aspx"
> it works fine.
Happy
New Year!!!
TIA
Moisés
Marked as answer by mbanavige on Dec 31, 2012 04:15 PM
Moises Durov...
Member
29 Points
81 Posts
menu with roles
Dec 29, 2012 11:57 AM|LINK
Hi Folks,
I have menu and roles, but menu does not obbey roles.
In the following code I let the roles "admin, financeiro" to access the root menu, and restrict the the first node only to role "admin".
I think that it should work, but it does not. What am I missing?
<siteMapNode title="Contas" description="Contas" roles="admin, financeiro"> <siteMapNode url="~/Fin/Contas/AbreConta.aspx" title="Consulta" description="Abrir" roles="admin"/> <siteMapNode title="Movimentar" description="Movimentar Contas" roles="financeiro, admin"> <siteMapNode url="~/Fin/Contas/ImpExtBcoSant.aspx" title="via Extrato" description="via Extrato" roles="financeiro, admin"/> <siteMapNode url="~/Fin/Contas/CreDeb.aspx" title="Registrar Movimentos" description="Registrar Movimentos" roles="financeiro, admin"/> <!--<siteMapNode url="~/Fin/Contas/DespIndividual.aspx" title="**Despesas Individuais" description="Registra Despesa Individuais dos Socios" roles="financeiro, admin"/>--> </siteMapNode>Moisés
pkellner
All-Star
24042 Points
3625 Posts
ASPInsiders
Moderator
MVP
Re: menu with roles
Dec 30, 2012 03:57 AM|LINK
Hmm, I've never seen the attribute roles= in siteMapNode. What I've always done is added to my web.config the proper role for the page and that keeps it from coming out on my web site.
that is:
<location path="SponsorListEmail.aspx"> <system.web> <authorization> <allow roles="superuser"/> <deny users="*"/> </authorization> </system.web> </location>HTHs
http://peterkellner.net
Microsoft MVP • ASPInsider
Moises Durov...
Member
29 Points
81 Posts
Re: menu with roles
Dec 30, 2012 11:33 AM|LINK
Thanks for your help, but it did not work.
Happy New Year.
Moisés
pkellner
All-Star
24042 Points
3625 Posts
ASPInsiders
Moderator
MVP
Re: menu with roles
Dec 30, 2012 02:45 PM|LINK
do you have in your sitemap
securityTrimmingEnabled="true"
also, check to make sure you have your <location></location> tags one level above </configuration>
Here is mine:
<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.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" siteMapFile="web.sitemap" securityTrimmingEnabled="true"/> </providers> </siteMap>http://peterkellner.net
Microsoft MVP • ASPInsider
pkellner
All-Star
24042 Points
3625 Posts
ASPInsiders
Moderator
MVP
Re: menu with roles
Dec 30, 2012 02:46 PM|LINK
I've got some example code in this post that might help out.
http://peterkellner.net/2008/05/19/codecampwebsiteseries2/
http://peterkellner.net
Microsoft MVP • ASPInsider
Dheerendra
Member
97 Points
60 Posts
Re: menu with roles
Dec 30, 2012 04:55 PM|LINK
This May be Helpful for you
http://msdn.microsoft.com/en-us/library/wce3kxhd(v=vs.100).aspx[^]
http://msdn.microsoft.com/en-us/library/ff647401.aspx[DataBase Role Based]
http://www.4guysfromrolla.com/articles/082703-1.aspx[^]
Moises Durov...
Member
29 Points
81 Posts
Re: menu with roles
Dec 30, 2012 10:20 PM|LINK
Congratulations!! Very good article.
I figure it out, in my web.config I was doing <location path="~/Fin/Contas/ImpExtBcoSant.aspx" > and it was not working. When I change to <location path="Fin/Contas/ImpExtBcoSant.aspx" > it works fine.
Happy New Year!!!
Moisés