Show Sitecore Config - can be useful for CD servers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@using Sitecore.Configuration | |
<!-- Author: Robert Senktas vel RobsonAutomator --> | |
<!-- Remove this file from server after usage --> | |
<!-- http://<hostname>/showconfig.cshtml?save=true saves xml to the App_Data folder --> | |
@{ | |
if (!Context.Request.IsLocal) | |
{ | |
Response.StatusCode = 404; | |
return; | |
} | |
var xmlDocument = Factory.GetConfiguration(); | |
if (Request.QueryString.HasKeys() && Request.QueryString.AllKeys.Any(x => x.Equals("save"))) | |
{ | |
var appDataPath = Context.Request.MapPath("~/App_Data"); | |
if (!string.IsNullOrWhiteSpace(appDataPath)) | |
{ | |
var xmlPath = Path.Combine(appDataPath, $"{Context.Server.MachineName}-Config.xml"); | |
xmlDocument.Save(xmlPath); | |
} | |
} | |
Response.ContentType = "text/xml"; | |
Response.Write(xmlDocument.OuterXml); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment