I have a publishing site on SharePoint 2013. Part of the site requires a custom navigation to replace the quick launch. I've written a UserControl that accesses the NavigationTermSet and uses the term titles and URLs to build a navigation.
Loading the NavigationTermSet:
using (SPSite site = new SPSite(SPContext.Current.Site.ID, SPUserToken.SystemAccount))
{
using (SPWeb web = site.OpenWeb(SPContext.Current.Web.ID))
{
TaxonomySession taxonomySession = new TaxonomySession(site);
StandardNavigationSettings navigationSettings = new WebNavigationSettings(web).CurrentNavigation;
TermStore termStore = taxonomySession.TermStores[navigationSettings.TermStoreId];
TermSet termSet = termStore.GetTermSet(navigationSettings.TermSetId);
_navTermSet = NavigationTermSet.GetAsResolvedByWeb(termSet, web, StandardNavigationProviderNames.CurrentNavigationTaxonomyProvider);
}
}I grab the term's friendly URL with the following:
navTerm.GetWebRelativeFriendlyUrl();
Pages containing this control load in less than a second for read-only users. Site Collection Administrators or Content Editors take about 8 seconds to load the same page. I've determined that the method in the code block above is the culprit for the long load times for admins and content editors. What is the deal with that? Can I do something differently to speed things up for admins?
Any help is appreciated.