BreadCrumb Shows old Path after moving SharePoint 2010 Site to Different Location

Recently we moved one of the SharePoint 2010 subsite to the upper level from "Site Settings >> Site content and structure". It successfully moved to the upper level in hierarchy. No problem. A piece of cake.

But when we checked the moved site from top level navigation, we observed that Breadcrumb was still showing the old path. Breadcrumb was the custom control but it was using nothing more than a SiteMap control and a SiteMapProvider "CurrentNavSiteMapProviderNoEncode".

With this issue, there was one more lined up. Current Site Navigation control (SharePointWebControls:AspMenu with PublishingNavigation:PortalSiteMapDataSource) on the page (having SiteMapProvider as "CurrentNavSiteMapProvider") was showing subsites based on previous parent site reference.

The issue seemed because of the SharePoint Object Cache which was not refreshed. SiteMapProviders are cached in the SharePoint object cache. One way to refresh the cache was to reset the app pool for that web application in IIS. But since this was the Production and a working day and not a showstopper issue, we didn't want to put Customer into trouble.

We checked the Current Navigation and Global Navigation items from "Site Settings >> Navigation" and surprisingly those items were shown correctly there. After observing those navigation items, we just clicked on the "Ok" button (without doing any changes) and then checked the breadcrumb and Site navigation controls again on the site's main page.

And we saw that both issues were FIXED automatically.

How this happened?

Well, this could be because by just clicking the "Ok" button in Navigation settings might have refreshed the SharePoint Object Cache completely (which caches "SiteMapProviders").

And hence the old cached references got refreshed for Site Map Providers and it showed new values correctly in Breadcrumb and Site Navigation control.