3

I am completely puzzled with this:

I have a custom SharePoint site with QuickLaunch on the left and Top Navigation Bar (which are of course visible by default).

This custom site has several sub-sites, which all inherit navigation from the root site.

Everything works fine, but after application pool recycle both menus on the left and on top are disappearing when I enter any of the sites for the first time! After simple refresh everything is back to normal, all menus are visible.

After recreating the site and subsites they behave the same: on first visit - menus are not visible, after refresh they are visible and they stay visible until I make an application pool recycle.

Sometimes only one menu (top bar or quick launch) disappears and the second one is normally visible, and I also think I encountered a situation when it disappeared during normal using of the site, not after the recycle.

There is nothing in the EventLog. There is a trace in the ULS log, though. When quick launch or top bar disappears only one new line (yes, only this one, no stack trace or any further information) is added:

02/05/2010 10:24:19.18 w3wp.exe (0x171C) 0x17BC Windows SharePoint Services General 8kh7 High Cannot complete this action. Try again.

Well, indeed it says that something is wrong that is causing the menu to disappear. Can anyone help me how to diagnose this or maybe knows why these menus are disappearing?

BenMorel
  • 34,448
  • 50
  • 182
  • 322
Gylo
  • 61
  • 2
  • 3
  • Did you ever figure out what exactly was causing this? I've read through this thread but nothing sticks out as applying to us. Both nav areas will randomly render or not render, randomly as I hit refresh in my browser. 10 minutes later it was fine for some subsites but not for others. Seems like SP is getting pretty wonky! – Tor Sep 04 '15 at 17:07

2 Answers2

0

Gylo do you have the Publishing feature enabled on those sites? This is a known situation when restoring saved site templates with publishing enabled (using a small hack) where the Top Navigation won't appear for the first time.

What version are you running? (Site Actions => Site Definitions shows it)

Francisco Aquino
  • 9,097
  • 1
  • 31
  • 37
  • No, the publishing feature is disabled. It's on MOSS 2007. You said this is a "known situation", do you have any links or resources? Maybe it's something similar. – Gylo Feb 05 '10 at 14:48
  • The 'known situation' happens when you do what I said (save a publishing site as a template, which is not allowed -- you need to use a small trick, and then restoring the site -- the menu will come broken and be fixed on the next refresh and on) – Francisco Aquino Feb 05 '10 at 16:30
  • OK, thanks for some clue, but I create the site and its subsited from a regular template (ONET.XML file) which is a simple template, with no extra features like publishing enabled. – Gylo Feb 06 '10 at 10:51
0

It may be that you messed with Navigation in site definition and removed Navigation Node with Id of 1002. This node is responsible for storing web Top Navigation, and even if your web uses shared navigation, you'll get disappearing navigation under some circumstances. Check if your-web.Navigation.TopNavigationBar is null. If it is, that is not very simple to restore node #1002. Below is a patch I've written to fix this issue on production environment. Test it first!

    public override void FeatureActivated(SPFeatureReceiverProperties properties)
    {
        SPSite site = properties.Feature.Parent as SPSite;

        using (SPWeb web = site.OpenWeb("/information"))
        {
            if (web.Navigation.TopNavigationBar == null)
            {
                List<SPContentDatabase> contentdatabases = new List<SPContentDatabase>();

                SPSecurity.RunWithElevatedPrivileges(delegate()
                {
                    SPNavigationNode node = new SPNavigationNode("", web.ServerRelativeUrl, false);

                    web.AllowUnsafeUpdates = true;

                    try
                    {
                        SPNavigationNodeCollection navigationNodes = null;
                        navigationNodes = web.Navigation.GlobalNodes;

                        navigationNodes.AddAsFirst(node);
                    }
                    finally
                    {
                        web.AllowUnsafeUpdates = false;
                    }

                    SPContentDatabase database = site.ContentDatabase;

                    using (SqlConnection con = new SqlConnection(database.DatabaseConnectionString))
                    {
                        con.Open();

                        using (SqlCommand command = con.CreateCommand())
                        {
                            command.CommandText = string.Format(@"UPDATE NavNodes
                            SET Url='', Eid={0}, ElementType=1, DocId=NULL
                            WHERE Eid={1}
                                and WebId='{2}'
                                and SiteId='{3}'",
                                1002,
                                node.Id,
                                web.ID.ToString(),
                                site.ID.ToString()
                            );

                            command.ExecuteNonQuery();
                        }
                    }
                });
            }
        }
    }
diamond
  • 21
  • 3
  • Please refer to [this article](https://support.microsoft.com/en-us/kb/841057) before executing any changes on SharePoint databases. – dstarkowski Dec 09 '15 at 10:41