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 136707
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T06:59:27+00:00 2026-05-11T06:59:27+00:00

Everytime I instantiate a PortalSiteMapProvider instance it always defaults to the Root Web Site

  • 0

Everytime I instantiate a PortalSiteMapProvider instance it always defaults to the Root Web Site Collection.

I want to be able to acquire a site map from a different collection from an application page.

Because of this, the context defaults to the root web since this application page resides under _layouts and is not hosted under any site collection.

How do I acquire an instance to a site collection other than the root web from an application page?

Thanks.

  • 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. 2026-05-11T06:59:28+00:00Added an answer on May 11, 2026 at 6:59 am

    You can’t read another site collection’s hierarchy through a PortalSiteMapProvider. E.g., if you are in Site Collection A, PSMP will only traverse A’s tree, not B. You have to be in B to traverse B.

    A workaround I implemented was to write a simple web service that runs in a site collection and takes a path as a parameter. It reads its own PSMP and writes an XML tree from that point in the hierarchy. Calling the web service living in SC-B from code running in SC-A is extremely fast, especially since the PSMP can rip through B’s structure so quickly.

    Edit:

    Here are instructions for creating a web service in WSS3/MOSS.

    Here is some totally non-functional code to get you headed in the right direction:

    //method exposed through the web service public XmlDocument GetTree(string path) {     PortalSiteMapProvider psmp = PortalSiteMapProvider.GlobalNavSiteMapProvider;     SiteMapNode node = psmp.FindSiteMapNode(path);     return BuildXmlFromNode(node); }  private XmlNode BuildXmlFromNode(SiteMapNode node) {     XmlDocument xml = new XmlDocument();     reutrn BuildXmlFromNode(node, xml); }  //recurses down the sitemapnode children private XmlNode BuildXmlFromNode(SiteMapNode node, XmlNode xml) {     XmlElement element = doc.CreateElement('Node')     element.SetAttribute('title', node.Title);     element.SetAttribute('url', node.Url);      xml.AppendChild(element);      foreach(SiteMapNode childNode in node.ChildNodes)     {         BuildXmlFromNode(childNode, element);     }      return xml; } 

    Please note if you don’t set a limit on the number of recursions and your site map hierarchy is very deep and/or wide, this could produce a HUGE xml document. Use with caution!

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

Sidebar

Related Questions

Everytime I upload a file to my ASP.NET site, all users are logged out
Everytime i retrieve data from a mysql stored procedure with a concat function an
I get an error everytime I upload my webapp to the provider. Because of
I have a old website that generate its own RSS everytime a new post
I am using an ASP.NET MVC project and everytime I add a class to
Today, everytime I try to open any .Net application I get: CLR error: 80004005
If my code throws an exception, sometimes - not everytime - the jsf presents
I have a medium size Java file. Everytime I make a change to one
I'm relatively new to Threading in Java and I've noticed that everytime I use
I'm wanting to decrement a variable in a MySQL table by one everytime an

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.