Note that there are some explanatory texts on larger screens.

plurals
  1. POThe securityTrimmingEnabled="true" in web.config works too good
    primarykey
    data
    text
    <p>I'm using C# ASP.NET 4 VS2010.</p> <p>I'm using membership with roles, which are already defined as usual.</p> <p>I have a <code>~/web.sitemap</code> file that includes this:</p> <p>(The <code>~/</code> security is Allow to all.)</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt; &lt;siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" &gt; &lt;siteMapNode url="" title="" description=""&gt; &lt;siteMapNode url="" title="A menu for the Administrator" description=""&gt; &lt;siteMapNode url="~/Admin/ResetPassword.aspx" title="Reset password for a user" description="" /&gt; &lt;siteMapNode url="~/Admin/SendEmailToUser.aspx" title="Send e-mail to a user" description="" /&gt; &lt;/siteMapNode&gt; &lt;siteMapNode url="" title="A menu for the SIC (second in command) person" description=""&gt; &lt;siteMapNode url="~/SIC/UnlockUser.aspx" title="Unlock a user" description="" /&gt; &lt;siteMapNode url="~/SIC/ApproveUser.aspx" title="Approve a user" description="" /&gt; &lt;/siteMapNode&gt; &lt;siteMapNode url="" title="A menu for users" description=""&gt; &lt;siteMapNode url="~/Users/MakeYourContribute.aspx" title="Make your contribution" description="" /&gt; &lt;siteMapNode url="~/Users/CheckOnYourBalance.aspx" title="Check on your balance" description="" /&gt; &lt;/siteMapNode&gt; &lt;siteMapNode url="" title="A menu for anonymous visitors" description=""&gt; &lt;siteMapNode url="~/AboutUs.aspx" title="About us" description="" /&gt; &lt;siteMapNode url="~/Application.aspx" title="Send an application to join us" description="" /&gt; &lt;/siteMapNode&gt; &lt;/siteMapNode&gt; &lt;/siteMap&gt; </code></pre> <p>and a web.config file that ends like this:</p> <pre><code> &lt;siteMap defaultProvider="XmlSiteMapProvider" enabled ="true"&gt; &lt;providers&gt; &lt;add name="XmlSiteMapProvider" type="System.Web.XmlSiteMapProvider" siteMapFile="~/web.sitemap" securityTrimmingEnabled="true" /&gt; &lt;/providers&gt; &lt;/siteMap&gt; &lt;/system.web&gt; &lt;/configuration&gt; </code></pre> <p>My menu is based on the <code>asp:Repeater</code> control and looks like this:</p> <pre><code>&lt;div&gt; &lt;ul&gt; &lt;li&gt; &lt;asp:hyperlink runat="server" id="lnkHome" navigateurl="~/Default.aspx"&gt;Home&lt;/asp:hyperlink&gt; &lt;/li&gt; &lt;asp:repeater runat="server" id="menu" datasourceid="SiteMapDataSource1"&gt; &lt;ItemTemplate&gt; &lt;li&gt; &lt;asp:HyperLink ID="lnkMenuItem" runat="server" NavigateUrl='&lt;%# Eval("Url") %&gt;'&gt;&lt;%# Eval("Title") %&gt;&lt;/asp:HyperLink&gt; &lt;asp:Repeater ID="submenu" runat="server" DataSource="&lt;%# ((SiteMapNode) Container.DataItem).ChildNodes %&gt;"&gt; &lt;HeaderTemplate&gt; &lt;ul&gt; &lt;/HeaderTemplate&gt; &lt;ItemTemplate&gt; &lt;li&gt; &lt;asp:HyperLink ID="lnkMenuItem" runat="server" NavigateUrl='&lt;%# Eval("Url") %&gt;'&gt;&lt;%# Eval("Title") %&gt;&lt;/asp:HyperLink&gt; &lt;/li&gt; &lt;/ItemTemplate&gt; &lt;FooterTemplate&gt; &lt;/ul&gt; &lt;/FooterTemplate&gt; &lt;/asp:Repeater&gt; &lt;/li&gt; &lt;/ItemTemplate&gt; &lt;/asp:Repeater&gt; &lt;/ul&gt; &lt;asp:sitemapdatasource id="SiteMapDataSource1" runat="server" showstartingnode="true" /&gt; &lt;/div&gt; </code></pre> <p>The security of allow/deny to folders is defined for the respective folders. There are 4 levels of security: 1) Administrators. 2)Second In Command (SIC). 3) Users (all registered users). 4) Anonymous users.</p> <p>For example, both the members of the Administrators role and the SIC role are allowed on the operate in the folder <code>~/SIC</code> , but the rest of the users are restricted from it.</p> <p>Now, as soon as I added the <code>securityTrimmingEnabled="true"</code> to the <code>web.config</code>, the only row I see on the menu is <code>Home</code>.</p> <p>Have I configured anything wrong?</p> <p>Are there any more configuration I need to make in order to have this security dependent menu work?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload