Pushing Sitecore to the limits and beyond

Sitecore SheerResponse.Download Error with XML

I had a solution where we need to generate an XML file and download it from the Sitecore client. But when using SheerResponse.Download to download an XML file, it would add 2 elements to the end of the XML document (see the image below). The issue was found in sitecore 8.1 rev. 151207 (Update-1).

Sitecore have registered this a bug and provided a solution where I had to modify the main layout for the Sitecore client and use several support DLL’s, I decided not to do this.

Solution

I therefore did what I consider to be a nasty hack, but better than the alternative of modifying the Sitecore client, so please do not judge me for this!

SheerUI has a Eval function, which allows you to execute JavaScript within the Sitecore client. So I added an A tag, with a link to the file and then called click on the link.

4 thoughts on “Sitecore SheerResponse.Download Error with XML”

My Sitecore case on this bug is 473183, which contains instructions and a DLL from support (I haven’t tried it yet). The developer next to me said that this defect has been coming and going since Sitecore 7.