title: SPNavigation - Displaying User Defined Navigation
body: <p>I'm trying to build a secondary navigation on a front end site, and I can't get past an issue.  In the code below, the output displays something similar to:</p>
  
  <pre>
  water
  -----water
  -----pollination
  -----dormancy
  pollination
  -----water
  -----pollination
  -----dormancy
  dormancy
  -----water
  -----pollination
  -----dormancy
  </pre>
  
  <pre><code>// Loop through Root Webs in Site Collection
  foreach (SPWeb TopLevelWebs in CurrentSite.AllWebs)
  {
      SPNavigationNodeCollection FirstLevelWebs = TopLevelWebs.Navigation.GlobalNodes[0].Children;
  
      // Loop through each Child of Web
      foreach (SPNavigationNode FirstLevelWebChild in FirstLevelWebs)
      {
          // Skip over pages and only look at webs (or "Area" as it is called in 'Properties')
          if (FirstLevelWebChild.Properties["NodeType"].ToString() != "Page")
          {
              Response.Write(FirstLevelWebChild.Title + "&lt;br /&gt;");
  
              SPNavigationNodeCollection SecondLevelWebs = FirstLevelWebChild.Navigation.GlobalNodes[0].Children;
              foreach (SPNavigationNode SecondLevelWebChild in SecondLevelWebs)
              {
                  // Skip over pages and only look at webs (or "Area" as it is called in 'Properties')
                  if (SecondLevelWebChild.Properties["NodeType"].ToString() != "Page")
                  {
                      Response.Write("-----" + SecondLevelWebChild.Title + "&lt;br /&gt;");
                  }
              }
          }
      }
  }
  </code></pre>
  
  <p>Why will the logic above not work for subsites under the top nodes?  I haven't fully understood the "GlobalNodes" property, so I have to assume that is where the problem lies.  But I can't come up with a solution.</p>
  
  <p>Any help would be greatly appreciated.</p>