Try our conversational search powered by Generative AI!

PageReference property resolves incorrectly


We have an upgraded EPiServer 7.5 site. Within that site there is function in place using pages as containers for info which is used for reference when producing content in a page. In short it is something like this:

Page A reads info from Page B. Page B contains a PageReference-property pointing to Page C (which is supposed to be used as a root page for listing). In the edit UI it all seems ok. But when we programmatically tries to read the property from Page B it does not resolve to the PageReference of Page C but itself (Page B).

Is it a bug or am I missing something?

Sep 02, 2014 21:04

How you resolve page reference? Is it pure 7.5 or above with some update applied?

Sep 02, 2014 21:17

I *think* you need to load Page B by yourself. Something like this:

if (pageA.LinkType == PageShortcutType.FetchData)
    var loader = ServiceLocator.Current.GetInstance();

    var reference = ContentReference.Parse(pageA.ExternalURL);

    var pageB = loader.Get(reference);   
Sep 02, 2014 23:13

The fetch data functionality is not handled in the API, but rather in the PageBase class, which implements ICurrentPage. Or similar class in mvc.

Sep 02, 2014 23:16

Below code runs in a UserControl on Page A (and is not working).

var loader = ServiceLocator.Current.GetInstance();

PageData pageBData = loader.Get(PageBReference);

PageReference pageCLink = pageBData.GetPropertyValue("PageCReference");
PageDataCollection pdc = GetChildren(pageCLink);

With a Url-property pointing to the same PageC it works well with PafeReference.ParseUrl()

Edited, Sep 03, 2014 13:42

Forgot to point out that the code above is not working.

Sep 04, 2014 9:06

I have another example of another case where things go wrong. We have a page where there is a PageReference-property which resolves incorrectly to the same page which is being rendered (in viewmode). But... in editmode it resolves to the correct page....

Sep 04, 2014 13:13

I think I've found a workaround and indication that this in fact is a bug. If I republish the page containing the PageReference it resolves correctly. Very strange behaviour and complicates the upgrade process. This is with version.

Sep 04, 2014 13:30

This certainly seems like a bug. I have tracked it down by downgrading the solution from 7.13.2 to 7.7.1. In 7.7.1 it works as expected but not in 7.8.0.

Sep 05, 2014 15:15

Note: The republishing did not solve the issue. When the Application Pool is restarted the problem re-appears.

Sep 05, 2014 15:20

I have the exakt same problem in my projekt. Have you found a soloution or reported it as a developer incident? 

Oct 16, 2014 16:29

I have not found a solution for this. Registered an incident. The customer decided not to send the project to the support. Partly because of the fact that this will not longer be a problem when they change the approach in the implementation. But also that there was no possibility that they would send the Visual Studio solution to the support. There was also no available time to recreate the problem in a separate VS-solution, so the decision was made to let the ticket die.

If you decide to file a ticket you maybe could point to our ticket for reference (DI-142444).

Oct 23, 2014 9:00

Bug 120581: Property of type PageReference may return invalid value.

Fix was released with EPiServer.CMS.Core 7.19.1

Dec 24, 2014 0:30
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.