+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / page.NavigationNode.GetFullUrl() causing exception

page.NavigationNode.GetFullUrl() causing exception

4 posts, 1 answered
  1. LUDWIG
    LUDWIG avatar
    7 posts
    Registered:
    06 Jul 2012
    11 Feb 2015
    Link to this post

    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?

     

  2. Nikola Zagorchev
    Nikola Zagorchev avatar
    424 posts
    Registered:
    08 Dec 2016
    16 Feb 2015
    Link to this post
    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
     
    Answered
  3. LUDWIG
    LUDWIG avatar
    7 posts
    Registered:
    06 Jul 2012
    11 Mar 2015 in reply to Nikola Zagorchev
    Link to this post
    That did it. Thanks.
  4. Nikola Zagorchev
    Nikola Zagorchev avatar
    424 posts
    Registered:
    08 Dec 2016
    11 Mar 2015
    Link to this post
    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
     
4 posts, 1 answered