page.NavigationNode.GetFullUrl() causing exception

Posted by Community Admin on 04-Aug-2018 14:15

page.NavigationNode.GetFullUrl() causing exception

All Replies

Posted by Community Admin on 11-Feb-2015 00:00

Hi,

I am using PageManager to get a list of pages of a site.

Whenever I call page.NavigationNode.GetFullUrl() an exception is thrown:

IsolationLevel cannot be changed while connection is in use. openaccess

   at OpenAccessRuntime.Relational.RelationalStorageManager.set_IsolationLevel(Nullable`1 value)
   at Telerik.Sitefinity.Data.ReadUncommitedRegion..ctor(IManager manager)
   at Telerik.Sitefinity.Multisite.MultisiteContext.SiteProxy.get_SiteMapName()
   at Telerik.Sitefinity.Web.SiteMapBase.DynamicSiteMapKeyResolver.get_NodeKey()
   at Telerik.Sitefinity.Web.SiteMapBase.FindSiteMapNodeFromKey(String key, Boolean ifAccessible)
   at Telerik.Sitefinity.Modules.Pages.PageExtensions.GetSiteMapNode(PageNode page, SiteMapBase& sitemapProvider, CultureInfo culture)
   at Telerik.Sitefinity.Modules.Pages.PageExtensions.GetUrl(PageNode page, Boolean backend, String paramString, CultureInfo culture, Boolean resolve)
   at Telerik.Sitefinity.Modules.Pages.PageExtesnsions.GetFullUrl(PageNode pageNode, CultureInfo culture, Boolean fallbackToAnyLanguage, Boolean localizeUrl)

 

My code is like that:

 

MultisiteContext mc = new MultisiteContext();
ISite site = mc.CurrentSite;
 
// get the id of the root site
Guid rootId = site.SiteMapRootNodeId;
 
// get a page manager and get the root node
PageManager pageManager = PageManager.GetManager();
PageNode rootNode = pageManager.GetPageNode(rootId);
 
// get the pages
IQueryable<PageData> pages = pageManager.GetPageDataList().Where(pData => pData.Status == ContentLifecycleStatus.Live);
 
foreach (var page in pages)
            string url = page.NavigationNode.GetFullUrl();

I am using Sitefinity 7.3. Did not have that problem with 7.1

Any ideas?

 

Posted by Community Admin on 16-Feb-2015 00:00

Hello Ludwig,

Could you please try the following code snippet for getting the PageData:

var multisiteContext = SystemManager.CurrentContext as MultisiteContext;
           ISite site = multisiteContext.CurrentSite;
 
           // get a page manager and get the root node
           PageManager pageManager = PageManager.GetManager();
           var rootNodeId = SiteInitializer.CurrentFrontendRootNodeId;
 
           // get the pages
           IQueryable<PageData> pages = pageManager.GetPageDataList()
               .Where(pData => pData.Status == ContentLifecycleStatus.Live
                   && pData.NavigationNode.RootNodeId == rootNodeId
                   && !pData.NavigationNode.IsDeleted);
 
           List<string> urls = new List<string>();
           foreach (var page in pages)
           
               string url = page.NavigationNode.GetFullUrl();
               urls.Add(url);
           

It is working on my end on a multisite instance through the sites.

Regards,
Nikola Zagorchev
Telerik
 
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
 

Posted by Community Admin on 11-Mar-2015 00:00

That did it. Thanks.

Posted by Community Admin on 11-Mar-2015 00:00

Hello Ludwig,

Thank you for letting us know. I have marked the reply as an answer.

Regards,
Nikola Zagorchev
Telerik

 
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
 

This thread is closed