Wednesday, May 4, 2011

EPiServerException: PageReference string cannot be null/empty

Nansen is currently working on a number of websites based on EPiServer CMS 6 R2 and we've encountered an editorial issue when saving and resizing images in the built in Image Editor.

Apparently there's a bug in CMS 6 R2 that handles the parent/parentId parameter in the Image Editor dialog incorrectly.

The error you get is:

"EPiServerException: PageReference string cannot be null/empty"

Steps to solve it:

1. Open the file:

C:\Program Files (x86)\EPiServer\CMS\6.1.379.0\Application\UI\CMS\Edit\ImageEditor\ImageEditor.aspx

2. Locate line 459:

var parent = "<%= Server.HtmlEncode(Request.QueryString["parentId"]) %>";

3. Add a fallback for handling "parent" as a parameter.

var parent = "<%= Server.HtmlEncode(Request.QueryString["parentId"]) %>";

// CMS6 R2 quick fix by Nansen
if(parent == "") {
parent = "<%= Server.HtmlEncode(Request.QueryString["parent"]) %>";