More in this section

Forums / General Discussions / Getting the current page name

Getting the current page name

2 posts, 0 answered
  1. Eric
    Eric avatar
    40 posts
    10 Apr 2009
    03 Feb 2010
    Link to this post

    I am attempting to log page requests and am not having success getting the current page name when users view content.   My first attempt resulted in cmsentrypoint.aspx every time.  I've since tried

    CmsManager manager = new CmsManager();
           string pageName = "";
           foreach (ICmsPage page in manager.GetPages())
               pageName = page.Name;

    but it does not seem to be working.  any ideas?  Thanks. 

  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    12 Sep 2017
    03 Feb 2010
    Link to this post
    Hello Eric,

    You could use the code below to get the current page and all data for it.

    ICmsUrlContext pageKey = (ICmsUrlContext)this.Context.Items[Telerik.Cms.Web.UrlHelper.CmsPageKey];
    Guid currentPageID = pageKey.PageID;
    var cmsManager = new CmsManager();
    IPage page = cmsManager.GetPage(currentPageID);

    Ivan Dimitrov
    the Telerik team

    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
    Follow the status of features or bugs in PITS and vote for them to affect their priority.
2 posts, 0 answered