SiteMap control based on user roles doesn't works
Posted
by nCdy
on Stack Overflow
See other posts from Stack Overflow
or by nCdy
Published on 2010-04-19T06:35:58Z
Indexed on
2010/04/19
6:43 UTC
Read the original article
Hit count: 329
<siteMapNode roles="*">
<siteMapNode url="~/Default.aspx" title=" Main" description="Main" roles="*"/>
<siteMapNode url="~/Items.aspx" title=" Adv" description="Adv" roles="Administrator"/>
....
any user can see Adv page. That is a trouble and a qustion : why and how to hide out of role sitenodes.
but if I do HttpContext.Current.User.IsInRole("Administrator")
it shows me if user in Administrator role or not.
web config :
<authentication mode="Forms"/>
<membership defaultProvider="SqlProvider" userIsOnlineTimeWindow="20">
<providers>
<add connectionStringName="FlowWebSQL" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" passwordFormat="Hashed" applicationName="/" name="SqlProvider" type="System.Web.Security.SqlMembershipProvider"/>
</providers>
</membership>
<roleManager enabled="true" defaultProvider="SqlProvider">
<providers>
<add connectionStringName="FlowWebSQL" name="SqlProvider" type="System.Web.Security.SqlRoleProvider" />
</providers>
</roleManager>
© Stack Overflow or respective owner