Illegal Characters in Path Exception in Sitecore Preview

Wed Sep 14 2011

Just filed a bug report with Sitecore Support. In case you are out there searching Google for the same exception, here’s the issue. This is Sitecore 6.4.1 rev. 110720.

One of my developers accidentally applied Layout Details to a template, instead of its Standard Values. This used to work, even though it is not a best practice. When opening items based on the template, most of the time he would get the error below. This seems to be due to WebEditRibbon.ConvertToJson not finding the Layout Details on the template, then calling the wrong method on XmlDocument (Load instead of LoadXml).
[ArgumentException: Illegal characters in path.]
System.IO.Path.CheckInvalidPathChars(String path) +142
System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength) +100
System.IO.Path.GetFullPath(String path) +187
System.Xml.XmlResolver.ResolveUri(Uri baseUri, String relativeUri) +131
System.Xml.XmlTextReaderImpl..ctor(String url, XmlNameTable nt) +135
System.Xml.XmlDocument.Load(String filename) +85
Sitecore.Web.UI.WebControls.WebEditRibbon.ConvertToJson(String layout) +210
Sitecore.Web.UI.WebControls.WebEditRibbon.Render(HtmlTextWriter output, Item item) +1268
Sitecore.Web.UI.WebControl.Render(HtmlTextWriter output) +387
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +246
System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter writer) +315
System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) +48
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +246
System.Web.UI.Page.Render(HtmlTextWriter writer) +40
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint,
Boolean includeStagesAfterAsyncPoint) +5290
The solution is simply to apply the layout details to the Standard Values, instead of the Template itself.

Nick Wesselman

Nick Wesselman started working professionally in software development just a few days after everyone realized we dodged a bullet with the Y2k bug. He’s worked as a Sitecore solution partner, Technology partner, and now for Sitecore itself. He lives with his wife, son, and daughter in Asheville, NC.