Exception in SubscriptionList webcontrol

Found in

EPiServer.CMS.Core 9.8.0

Fixed in

EPiServer.CMS.Core 9.10.0


May 10, 2016


Jun 03, 2016


CMS Core


Closed, Fixed and tested


Steps to reproduce

  1. Add the property EPSUBSCRIBE of any type on, for example, a Standard Page.
  2. Assign to the property any value under the start page and publish changes.
  3. Create an .aspx page.
  4. Add <EPiServer:SubscriptionList runat="server" ID="myList" />.
  5. In the codebehind, add this in OnLoad().

         myList.PageLinkProperty = null;
         myList.PageLink = PageReference.StartPage;

6. Add a new property to the web.config under profile/properties.

<add name="SubscriptionInfo" type="EPiServer.Personalization.SubscriptionInfo, EPiServer"/>

Surfing this page gives an error:

Server Error in '/' Application.

Unable to cast object of type 'EPiServer.Core.ContentReference' to type 'EPiServer.Core.PageReference'.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

[InvalidCastException: Unable to cast object of type 'EPiServer.Core.ContentReference' to type 'EPiServer.Core.PageReference'.]
EPiServer.DataAbstraction.SubscriptionService.GetSubscriptionPages(PageReference root) +254
EPiServer.Web.WebControls.SubscriptionList.PopulatePages(PageDataCollection pages) +177
EPiServer.Web.WebControls.PageControlBase.GetPages() +61
EPiServer.Web.WebControls.SubscriptionList.CreateChildControls() +73