Try our conversational search powered by Generative AI!

Marthin Freij
Feb 8, 2010
  5787
(0 votes)

Problem with constructing PageReferences in Page Providers

Recently I have spent some time implementing page providers for a customer. A couple of days ago I noticed that one of the page providers started to behave strange for one particular PageId. The PageReference for that page had RemoteSite set to null instead of the page providers ProviderKey. This means that the PageReference will point on a page in the LocalPageProvider rather than on my page in my custom page provider. After some investigation it was clear that this particular PageReference was equal to the PageReference of the page providers EntryPoint.

The problem seemed to be related to constructing the PageReference which was handled by the PageProviderBase.ConstructPageReference methods. Reflecting these methods with Reflector made it clear that PageReferences are constructed with RemoteSite set to ProviderKey only if PageId is not equal to EntryPoint.ID. The workaround is to construct the PageReference yourself and always set the ProviderKey part. Be careful though when you are constructing ParentLink for top-level pages because it in these cases is located on the LocalPageProvider.

Feb 08, 2010

Comments

Sep 21, 2010 10:33 AM

The reason for the behaviour for ConstructPageReference is to construct correct ParentLink for first level pages (that is children to entry point).
However this has shown to be confusing so in CMS6 we have added a new method ConstructLocalPageReference that always set RemoteSite part to ProviderKey.

morten.petersen@creuna.dk
morten.petersen@creuna.dk Sep 21, 2010 10:33 AM

Is there a solution or workaround for this? My PageProvider works fine, except when creating a new element. When leaving NewPage.aspx the parentid is unfortunately translated to a LocalPageProvider id. Ie. '1__PositionProvider' is translated to '1'

Please login to comment.
Latest blogs
Azure AI Language – Abstractive Summarisation in Optimizely CMS

In this article, I show how the abstraction summarisation feature provided by the Azure AI Language platform, can be used within Optimizely CMS to...

Anil Patel | Apr 18, 2024 | Syndicated blog

Fix your Search & Navigation (Find) indexing job, please

Once upon a time, a colleague asked me to look into a customer database with weird spikes in database log usage. (You might start to wonder why I a...

Quan Mai | Apr 17, 2024 | Syndicated blog

The A/A Test: What You Need to Know

Sure, we all know what an A/B test can do. But what is an A/A test? How is it different? With an A/B test, we know that we can take a webpage (our...

Lindsey Rogers | Apr 15, 2024

.Net Core Timezone ID's Windows vs Linux

Hey all, First post here and I would like to talk about Timezone ID's and How Windows and Linux systems use different IDs. We currently run a .NET...

sheider | Apr 15, 2024

What's new in Language Manager 5.3.0

In Language Manager (LM) version 5.2.0, we added an option in appsettings.json called TranslateOrCopyContentAreaChildrenBlockForTypes . It does...

Quoc Anh Nguyen | Apr 15, 2024

Optimizely Search & Navigation: Boosting in Unified Search

In the Optimizely Search & Navigation admin view, administrators can set a certain weight of different properties (title, content, summary, or...

Tung Tran | Apr 15, 2024