More in this section
Forums / Developing with Sitefinity / Querying pages

Querying pages

The forums are in read-only mode. In case that you want to directly contact the Progress Sitefinity team use the support center. In our Google Plus group you can find more than one thousand Sitefinity developers discussing different topics. For the Stack Overflow threads don’t forget to use the “Sitefinity” tag.
2 posts, 0 answered
  1. Annie
    Annie avatar
    46 posts
    11 Aug 2012
    17 Apr 2012
    Link to this post

    I need to programmatically retrieve pages that match a certain url. I have the following code
    but I want to get the page based on the url of the page, when I tried to use p.getFullUrl I get 
    an error message saying that method is not implemented for querying the database

     IQueryable<PageNode> pagenodes = pageManager.GetPageNodes().Where(p => p.Parent != null && p.Parent.UrlName.ToString().ToLower() == "books");

  2. Ivan Eftimov
    Ivan Eftimov avatar
    23 posts
    08 Feb 2017
    18 Apr 2012
    Link to this post

    From what I understand, you want to get a page by its URL.
    I would recommend two ways of doing this:


    PageManager pageManager = PageManager.GetManager();
    PageNode pageNode = pageManager.GetPageNodes().Where(pN => pN.UrlName == "childofhome").FirstOrDefault();


    var page = SitefinitySiteMap.GetCurrentProvider().FindSiteMapNode("childofhome ");
    PageNode pageNode = PageManager.GetManager().GetPageNodes().Where(p => p.Title == page.Title).First();

    Page title is also a unique attribute for every page.
    Both of the approaches above will return the corresponding node; if you want to extract the url of the node, use:
    pageNode.GetUrl() or pageNode.GetFullUrl(). Example of the returned URL may look like: ~/home/childofhome/

    I can also recommend you a reference from Sitefinity Documentation which describes querying pages:

    If my response did not fully answer your question, do not hesitate to contact me again, and explain me in more details your case.

    All the best,
    the Telerik team
    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 Public Issue Tracking system and vote to affect the priority of the items
2 posts, 0 answered