<commit_before>---
layout: post
title: "Sitecore Content Delivery ShowConfig.aspx"
date:   2017-06-30 00:00:00 -0500
categories: Sitecore
tags: ShowConfig.aspx CD
author: <NAME>
---

* content
{:toc}

## Overview

I just wanted to share a quick shortcut I recently used.  I had the need to view the Sitecore configuration on a content delivery server.  The problem was the content delivery server was already hardened and all non-essential files were removed, including ShowConfig.aspx. I created a temporary ShowConfig.aspx that can be dropped anywhere on the content delivery server. A request can be made against this page to return the contents of the typical show config. Once you have what you need, you MUST delete the temporary ShowConfig.aspx as there are no security checks preventing an unauthenticated user from viewing the configuration.






## ShowConfig.aspx


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

<script language="C#" runat="server">
    public void Page_Load(object sender, EventArgs e)
    {
        XmlDocument configuration = Factory.GetConfiguration();
        this.Response.ContentType = "text/xml";
        this.Response.Write(configuration.OuterXml);
    }
</script>
```

When you are directly on the Content Delivery server, you can use notepad to create an empty ShowConfig.aspx (or a file of another name), and paste the contents from above into that file.  This is a quick way to get a functioning ShowConfig.aspx on a server that does not normally have it.

> NOTE: You MUST delete this file immediately after use as there are no security restrictions<commit_msg>Added a comment in the script.<commit_after>---
layout: post
title: "Sitecore Content Delivery ShowConfig.aspx"
date:   2017-06-30 00:00:00 -0500
categories: Sitecore
tags: ShowConfig.aspx CD
author: <NAME>
---

* content
{:toc}

## Overview

I just wanted to share a quick shortcut I recently used.  I had the need to view the Sitecore configuration on a content delivery server.  The problem was the content delivery server was already hardened and all non-essential files were removed, including ShowConfig.aspx. I created a temporary ShowConfig.aspx that can be dropped anywhere on the content delivery server. A request can be made against this page to return the contents of the typical show config. Once you have what you need, you MUST delete the temporary ShowConfig.aspx as there are no security checks preventing an unauthenticated user from viewing the configuration.






## ShowConfig.aspx


``` c#
<%--
    This is intended to be a temporary file that must be removed when finished.    
--%>

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

<script language="C#" runat="server">
    public void Page_Load(object sender, EventArgs e)
    {
        XmlDocument configuration = Factory.GetConfiguration();
        this.Response.ContentType = "text/xml";
        this.Response.Write(configuration.OuterXml);
    }
</script>
```

When you are directly on the Content Delivery server, you can use notepad to create an empty ShowConfig.aspx (or a file of another name), and paste the contents from above into that file.  This is a quick way to get a functioning ShowConfig.aspx on a server that does not normally have it.

> NOTE: You MUST delete this file immediately after use as there are no security restrictions
{'fraction_non_alphanumeric': 0.07932960893854749, 'fraction_numerical': 0.01005586592178771, 'mean_word_length': 4.197387518142235, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '416321', 'n_tokens_mistral': 997, 'n_tokens_neox': 903, 'n_words': 452}