Try our conversational search powered by Generative AI!

Exception in SubscriptionList webcontrol

Found in

EPiServer.CMS.Core 9.8.0

Fixed in

EPiServer.CMS.Core 9.10.0

(Or a related package)

Created

May 10, 2016

Updated

Jun 03, 2016

Area

CMS Core

State

Closed, Fixed and tested


Description

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;
         myList.DataBind();

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