Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6386105
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:58:57+00:00 2026-05-25T02:58:57+00:00

I can’t figure this one out. I have the following SiteMap <?xml version=1.0 encoding=utf-8

  • 0

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 with securityTrimmingEnabled="true", which points to this site map file.

    • The file I want to trim has an authorization rule in it’s folder’s web.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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T02:58:58+00:00Added an answer on May 25, 2026 at 2:58 am

    In reading http://forums.asp.net/t/975077.aspx/1 I found out that this is exactly what is happening to me.

    If the node doesn’t have an URL it behaves fine, but if it does, like all of my nodes do. Security trimming is just ignored.

    I resolved my problem by resorting to a more intuitive role based site map implementation, to say:

    public class TrimmingXmlSiteMapProvider : XmlSiteMapProvider
    {
        public override bool IsAccessibleToUser(HttpContext context, SiteMapNode node)
        {
            if (node.Roles.Cast<string>().Any(r => r == "*"))
                return true;
    
            if (node.Roles.Count > 0 && node.Roles.Cast<string>().Count(Roles.IsUserInRole) == 0)
                return false;
    
            return node.ParentNode != null && node.ParentNode.IsAccessibleToUser(context);
        }
    }
    

    Then, the only change I had to make was add an asterisk to the root level’s role definition.

    How does this work?

    First I check if any of the roles definied for this node is an asterisk, if that’s the case, then I can see the node.

    Second, if the node isn’t everyone-level, I check if there are any roles specified, and if the logged in user is part of at least one of them.

    Lastly, I check if there is a parent node, and just inherit their rule.

    This allows the security trimming to actually be “SECURITY TRIMMING” and not well, however the heck it’s supposed to be working by default.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can't figure out how to do this in a pretty way : I have
can I make my own headers in HTTP request ? e.g. This is normal
Can I figure out if a function has already been assigned to an event?
Can't work out a way to make an array of buttons in android. This
Can anyone help me trying to find out why this doesn't work. The brushes
can any one tell me how can change this java code into objective c.is
Can this be done? It seems like this should be possible. In general, I
Can somebody help me with this. There is HTML code: <h3> <label> <input type=checkbox
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I have a jquery bug and I've been looking for hours now, I can't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.