I can't figure this one out.
I have the following SiteMap
<?xml version="1.0" encoding="utf-8" ?> <siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" > <siteMapNode url="~/" title="Root" description="Go root"> <siteMapNode url="~/h" title="Home" description="Go home" /> <siteMapNode url="~/h/uo" title="Ultima Online" description="Ultima Online"> <siteMapNode url="~/h/uo/get" roles="RegisteredUser" title="Get account!" description="Get account!" /> </siteMapNode> </siteMapNode> </siteMap>
I've an
XmlSiteMapProvider
withsecurityTrimmingEnabled="true"
, which points to this site map file.The file I want to trim has an
authorization
rule in it's folder'sweb.config
<configuration> <system.web> <authorization> <deny users="?" /> </authorization> </system.web> </configuration>
The file can't be accessed via url, if I type
http://localhost/h/uo/get
I get redirected to login page.I've set up an
<asp:Menu>
like this in the Master page file:<asp:SiteMapDataSource ID="MenuSiteMap" ShowStartingNode="false" SiteMapProvider="MenuSiteMapProvider" runat="server" /> <div> <asp:Menu ID="NavigationMenu" runat="server" DataSourceID="MenuSiteMap" CssClass="menu" EnableViewState="false" IncludeStyleBlock="false" Orientation="Horizontal" /> </div>
Yet, when the page is rendered, I see the Get account
node that is supposed to be trimmed when I'm not even logged in, no matter what.
- What am I doing wrong?
- Is there any other way to build a security trimming enabled site map navigation menu?
I'm using ASP.NET 4.0, and URL-rewritting with an HttpModule.