Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Page ID's constants not working in DTAP

Vote:
 

Hi,

In a lot of our projects we create a class or a struct with static properties which contain references to specific pages. This is very helpful because this reference is a unique ID. This gives us the ability to move a page in the tree without breaking links. In EPiServer we're using the Page ID:

this.RedirectToPageReference(new PageReference(PageLinkIDs.BusinessDashboardPage));

The PageReference or ContentReference is also used in the ContentRepository so I guess this way is the suggested way to approach this.

However, when you deploy content to a different environment within the DTAP street, the ID changes which breaks our functionality. I tried using a pages GUID, but this also won't work.

Moving these properties to a config file is not very clean so I want to avoid that. Is there any way to persist the Page ID of a page when installing the content on a new environment? Or is there a best practice for this?

Hope somebody can help. How are you doing this?

#112996
Nov 10, 2014 12:55
Vote:
 

I guess you deploy the content in an episerver export package (.episerverdata file)?

If so then the Content Guids should remain the same if you set flag

DataImporter.KeepIdentity = true;

#113003
Nov 10, 2014 13:56
Vote:
 

You could add pagereference properties for these pages on the start page, instead of having them hardcoded in class or config file. Then have a static helper class where you can retrieve these.

#113018
Nov 10, 2014 17:23
Jim - Jan 08, 2021 18:18
Could someone give an example for this (if this method is still relevant)?
* 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.