Some evil Sitecore inline admin aspx pages for quick and dirty actions on the server. I didn’t create all those, just collecting them here for your conveniences.

Use with caution, I am not responsible for any damages if caused by any of the code below:

  1. ShowConfig page without /Sitecore or admin login
<%@ Page Language="C#" AutoEventWireup="true" %>
<%@ Import NameSpace="Sitecore.Configuration" %>
<%@ Import NameSpace="System.Xml" %>
<html>
<head>
<title>Evil ShowConfig</title>
<script runat="server">
                protected void Page_Load(object sender, EventArgs e)
                {
                                XmlDocument configuration = Factory.GetConfiguration();
                                Response.Clear();
                                Response.ContentType = "text/xml";
                                Response.Write(configuration.OuterXml);
                                Response.End();
                }
</script>
</head>
<body></body>
</html>


Credit of this one goes to Dennis Lee : http://codingdennis.blogspot.com/2017/02/sitecore-showconfig-on-cd-servers.html

  1. Rebuild Sitecore_Analytics_Index
<%@ Page Language="C#" AutoEventWireup="true" %>
<%@ Import NameSpace="System.Xml" %>
<%@ Import NameSpace="Sitecore.ContentSearch" %>
<%@ Import NameSpace="Sitecore.Configuration" %>
<%@ Import NameSpace="Sitecore.Analytics.Processing.ProcessingPool" %>
<%@ Import NameSpace="Sitecore.Analytics.Data.DataAccess.MongoDb" %>
<%@ Import NameSpace="Sitecore.Analytics.Model" %>
<html>
<head>
<title>Very Evil ShowConfig</title>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
ContentSearchManager.GetIndex("sitecore_analytics_index").Reset();
                var poolPath = "aggregationProcessing/processingPools/live";
                var pool = Factory.CreateObject(poolPath, true) as ProcessingPool;
                var driver = MongoDbDriver.FromConnectionString("analytics");
                var visitorData = driver.Interactions.FindAllAs<VisitData>();
                var keys = visitorData.Select(data => new InteractionKey(data.ContactId, data.InteractionId));
                foreach(var key in keys)
                {
                    var poolItem = new ProcessingPoolItem(key.ToByteArray());
                    pool.Add(poolItem);
                }
}
</script>
</head>
<body>Rebuild Indexes, added to mongo ProcessingPool</body>
</html>


Credit goes to https://community.sitecore.net/technical_blogs/b/getting_to_know_sitecore/posts/rebuilding-the-sitecore-analytics-index

  1. Quick Server Firewall or network test. Use with query string ?url=https%3A%2F%2Fwww.google.com
<%@ Page Language="C#" AutoEventWireup="true" %>
<%@ Import Namespace="System.Xml" %>
<%@ Import Namespace="System.Net" %>
<%@ Import Namespace="System.IO" %>
<html>
<head>
<title>Very Evil File</title>
<script runat="server">
                protected void Page_Load(object sender, EventArgs e)
                {
                                var url = HttpContext.Current.Request.QueryString["url"];
                                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
                                request.Timeout = 15000;
                                request.Method = "GET";
                try
                {
                                using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
                {
                                var body = "";
                                using (StreamReader reader = new StreamReader(response.GetResponseStream()))
                {
                              body = reader.ReadToEnd();
                }
                              textLbl.Text = response.StatusCode + body;
                }
                }
                              catch (WebException ex)
                {
                              textLbl.Text = ex.Message;
                }
                }
</script>
</head>
<body>
<asp:Literal ID="textLbl" runat="server" /></body>
</html>


  1. Get server IP address (Maybe useful to get server IP for Azure Web App)
<% @ Page Language="C#" %>
<script runat="server" language="cs">
    protected override void OnPreInit( EventArgs e ) {
        Response.Cache.SetCacheability( System.Web.HttpCacheability.NoCache );
        Sitecore.Analytics.Tracker.Enabled = false;
        if ( Sitecore.Analytics.Tracker.Current != null && Sitecore.Analytics.Tracker.Current.CurrentPage != null )
            Sitecore.Analytics.Tracker.Current.CurrentPage.Cancel();
    }
</script>
<pre>
<%=  (new System.Net.WebClient()).DownloadString("https://api.ipify.org/?format=json") %>
</pre>

  1. End xDB Session
<%@ Page Language="C#" AutoEventWireup="true" %>
<html>
<head>
<title>End Session</title>
<script runat="server">
                protected void Page_Load(object sender, EventArgs e)
                {
                                HttpContext.Current.Session.Abandon();
                                Sitecore.Analytics.Tracker.Current.EndVisit(true);
                                Sitecore.Analytics.Tracker.Current.EndTracking();
                }
</script>
</head>
<body>Session Ended</body>
</html>

  1. View configuration app settings
<%@ Page Language="C#" AutoEventWireup="true" %>
<html>
<head>
<title>Versions</title>
</head>
<body>
<%=System.Configuration.ConfigurationManager.AppSettings["SitecoreBaselineBuildVersion"]%>
    <br/>
<%=System.Configuration.ConfigurationManager.AppSettings["CustomSolutionVersion"]%>
</body>
</html>

  1. Clear cache
<%@ Page Language="C#" AutoEventWireup="true" %>
<%@ Import NameSpace="Sitecore.Configuration" %>
<%@ Import NameSpace="System.Xml" %>
<html>
<head>
<title>Evil Clear Cache</title>
<script runat="server">
                protected void Page_Load(object sender, EventArgs e)
                {
                  Sitecore.Caching.CacheManager.ClearAllCaches();
                                Response.Clear();
                                Response.ContentType = "text/html";
                                Response.Write("Cache cleared");
                                Response.End();
                }
</script>
</head>
<body></body>
</html>