I am working on a project which allows the use of SharePoint 2010 as a content management source but will publish out to another web app. There are a number of reasons for this that I'm not going to cover just now.

My main issue at the moment though is that whilst iterating through the SiteMapNodeCollection obtained as below and then check each node whether its accessible or not, the result is always "true".

I've even tried creating a new HTTP Context so that my user account wasnt used, however the result is that the nodes are always accessible (even when anonymous access is disabled).

How do I get the correct value - i.e. False when the page is not anonymously accessible, true when it is?

Get the Nodes

PortalSiteMapProvider map = PortalSiteMapProvider.GlobalNavSiteMapProvider;
var nodes = map.RootNode.ChildNodes;

check the nodes accessibility

var myContext = HttpContext.Current;
HttpRequest httpRequest = Node.Url.StartsWith("/") ? new HttpRequest(Node.Title,     SPContext.Current.Site.Url +Node.Url, string.Empty) : new HttpRequest(Node.Title, Node.Url, string.Empty);
var httpResponse = new HttpResponse(TextWriter.Null);
var testContext = new HttpContext(httpRequest, httpResponse);

NavigationItem navItem = new NavigationItem { Title = Node.Title, Url = Node.Url, Secured = Node.IsAccessibleToUser(testContext) };
  • Did you find the answer to this? If yes, could you post the answer?
    – Kit Menke
    Jul 29, 2011 at 16:39

1 Answer 1


Make sure that the system.web -> SiteMap -> Provider attribute SecurityTrimmingEnabled is set to 'true' in your web.config file?

See MSDN article on ASP.NET security trimming for more information.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.