Tag : content-delivery

ShowConfig on Content Delivery

The Problem

Today I was troubleshooting a problem on a content delivery server. I knew the problem was around configs, but I needed to see the combined config to determine what the exact problem was. Normally, I would login to Sitecore and go to /sitecore/admin/showconfig.aspx and I would see a beautiful XML file that shows me the merged config.

The problem? The Sitecore back-end is removed on content delivery servers! There’s nowhere for me to login, and there’s now ShowConfig.aspx.

What to do?

Idea

I remembered back to a Kam post in which he demonstrated how to login to Sitecore without credentials, as long as you had file system access. I have file system access to the CD right now… can I create my own ShowConfig?

Investigation

Using dotPeek, I reflected into Sitecore.Client.dll and was able to see that all the ShowConfig.aspx file is is a call to CheckSecurity(), followed by Factory.GetConfiguration() which is dumped into the response. Simple enough, no?

Implementation

I created an XML file in the Website directory on the CD called ShowConfig.aspx and copy/pasted the code from the real showconfig into it. I had to change around the formatting a bit in order to convert a .cs file into an .aspx file.

Here is the result:

<%@ Page Language="C#" AutoEventWireup="true">
<%@ Import Namespace="Sitecore.Configuration">
<%@ Import Namespace="System">
<%@ Import Namespace="System.Xml">


<% 
 XmlDocument configuration = Factory.GetConfiguration(); 
 Response.ContentType = "application/xml"; 
 Response.Write(configuration.OuterXml); 
%>

It’s as simple as that! I can now navigate to /showconfig.aspx and see the merged config on the CD instance.

Don’t forget to remove this file when you’re done!