Try our conversational search powered by Generative AI!

PageReference property resolves incorrectly

Vote:
 

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?

#90138
Sep 02, 2014 21:04
Vote:
 

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

#90140
Sep 02, 2014 21:17
Vote:
 

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);   
}
#90146
Sep 02, 2014 23:13
Vote:
 

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

#90147
Sep 02, 2014 23:16
Vote:
 

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()

#90198
Edited, Sep 03, 2014 13:42
Vote:
 

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

#90228
Sep 04, 2014 9:06
Vote:
 

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....

#90250
Sep 04, 2014 13:13
Vote:
 

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. 7.13.2.0.

#90253
Sep 04, 2014 13:30
Vote:
 

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.

#90320
Sep 05, 2014 15:15
Vote:
 

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

#90321
Sep 05, 2014 15:20
Vote:
 

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

#111622
Oct 16, 2014 16:29
Vote:
 

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).

#112129
Oct 23, 2014 9:00
Vote:
 

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

Fix was released with EPiServer.CMS.Core 7.19.1

#114847
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.