Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Tobias Nylin 24 posts 116 karma points
    Jun 03, 2016 @ 08:50
    Tobias Nylin
    0

    Get original page id when using umbracoInternalRedirectId

    Hi! When using umbracoInternalRedirectId the ID for the page that is fetching content is overriden by the ID from the page that is retrieved.

    I need the original ID for the highlighting of the main menu on the site. For example, if I fetch a page that is a child to another node on the site that node will be highlighted.

    Is it possible to get the original ID?

  • Asbjørn 75 posts 180 karma points c-trib
    Nov 14, 2016 @ 07:54
    Asbjørn
    0

    Hi,

    I ran into this problem myself and managed to find a solution. You can get the original content using this property:

    UmbracoContext.Current.PublishedContentRequest.InitialPublishedContent
    

    I use this code snippet in my menu partial:

    CurrentPage = content;
    if (UmbracoContext.Current.PublishedContentRequest.IsInternalRedirectPublishedContent)
    {
        //Current page is an internal redirect. We want to use the initial published content, BEFORE the redirect
        CurrentPage = UmbracoContext.Current.PublishedContentRequest.InitialPublishedContent;
     }
    
Please Sign in or register to post replies

Write your reply to:

Draft