public Task <IEnumerable <SitemapEntry> > GetEntriesAsync(SitemapParams sitemapParams, CultureInfo culture, int offset, int count) { // Get the instance of CompositeC1SiteMapProvider configured in the Web.config file //<siteMap defaultProvider="CompositeC1"> // <providers> // <add name="CompositeC1" type="Composite.AspNet.CompositeC1SiteMapProvider, Composite" /> // </providers> //</siteMap> var provider = SiteMap.Provider as CmsPageSiteMapProvider; if (provider == null) { throw new Exception("SiteMap provider is not configured in Web.config to use Composite.AspNet.CompositeC1SiteMapProvider."); } // Because the GetRootNodes -> LoadSiteMap needs a valid HttpCurrent we create it if it is null // by only using specifying the baseUrl in the HttpRequest object // Source: CompositeC1 -> CompositeC1SiteMapProvider.cs (line 276) RequestUtils.DefineHttpContextIfNotExist(sitemapParams.BaseUrl); var entriesList = new List <SitemapEntry>(); var rootNodes = provider.GetRootNodes().ToList(); // Get root node associated to culture and website var rootNode = rootNodes.FirstOrDefault(node => node.Culture.Equals(culture) && node.Page?.Id == sitemapParams.Website); var pageIdsToExclude = _pageToExcludeProvider.GetPageIdsToExclude(sitemapParams.Website, culture); var allNodes = rootNode?.GetAllNodes() .OfType <CmsPageSiteMapNode>() .Where(node => node.Page == null || !pageIdsToExclude.Contains(node.Page.Id)) .Select(node => CreateSitemapEntryFromCompositeC1SiteMapNode(sitemapParams.BaseUrl, node)); entriesList.AddRange(allNodes); var dynamicTypesToInclude = _dynamicPagesEntryProvider.GetEntries(sitemapParams, culture); entriesList.AddRange(dynamicTypesToInclude); return(Task.FromResult(entriesList as IEnumerable <SitemapEntry>)); }