Created
February 8, 2022 04:03
-
-
Save nehemiahj/7f283bff93b7a3d7138c61ff5c10c7cf to your computer and use it in GitHub Desktop.
To view the request and context data for troubleshooting
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
<%@ Page Language="C#" AutoEventWireup="true" Debug="true" %> | |
<html> | |
<head> | |
<title> CMS Context Information</title> | |
</head> | |
<body> | |
<h1 style="text-align: center"> | |
CMS Context Information</h1> | |
<div> | |
<h2> | |
Sitecore Context Data:</h2> | |
<table border="1" style="border-collapse: collapse"> | |
<tr> | |
<th> | |
Key | |
</th> | |
<th> | |
Value | |
</th> | |
</tr> | |
<% | |
Response.Write(String.Format("<tr><td>{0}</td><td>{1}</td></tr>", "Database.Name", Sitecore.Context.Database.Name )); | |
Response.Write(String.Format("<tr><td>{0}</td><td>{1}</td></tr>", "Device.Name", Sitecore.Context.Device.Name)); | |
Response.Write(String.Format("<tr><td>{0}</td><td>{1}</td></tr>", "Domain.Name", Sitecore.Context.Domain.Name )); | |
Response.Write(String.Format("<tr><td>{0}</td><td>{1}</td></tr>", "Language.Name", Sitecore.Context.Language.Name )); | |
Response.Write(String.Format("<tr><td>{0}</td><td>{1}</td></tr>", "Site.Database.Name",Sitecore.Context.Site.Database.Name )); | |
Response.Write(String.Format("<tr><td>{0}</td><td>{1}</td></tr>", "Site.Device",Sitecore.Context.Site.Device )); | |
Response.Write(String.Format("<tr><td>{0}</td><td>{1}</td></tr>", "Site.Domain.Name", Sitecore.Context.Site.Domain.Name)); | |
Response.Write(String.Format("<tr><td>{0}</td><td>{1}</td></tr>", "Site.HostName",Sitecore.Context.Site.HostName )); | |
Response.Write(String.Format("<tr><td>{0}</td><td>{1}</td></tr>", "Site.Language",Sitecore.Context.Site.Language )); | |
Response.Write(String.Format("<tr><td>{0}</td><td>{1}</td></tr>", "Site.Name", Sitecore.Context.Site.Name)); | |
Response.Write(String.Format("<tr><td>{0}</td><td>{1}</td></tr>", "User.Name", Sitecore.Context.User.Name)); | |
%> | |
</table> | |
</div> | |
<div> | |
<h2> | |
Request Data:</h2> | |
<table border="1" style="border-collapse: collapse"> | |
<tr> | |
<th> | |
Key | |
</th> | |
<th> | |
Value | |
</th> | |
</tr> | |
<% | |
System.Collections.Specialized.NameValueCollection coll; | |
int loop1, loop2; | |
// Load Header collection into NameValueCollection object. | |
coll=Request.Headers; | |
// Put the names of all keys into a string array. | |
String[] arr1 = coll.AllKeys; | |
for (loop1 = 0; loop1<arr1.Length; loop1++) | |
{ | |
// Get all values under this key. | |
String[] arr2=coll.GetValues(arr1[loop1]); | |
for (loop2 = 0; loop2<arr2.Length; loop2++) | |
{ | |
Response.Write(String.Format("<tr><td>{0}</td><td>{1}</td></tr>", arr1[loop1], arr2[loop2])); | |
} | |
} | |
Response.Write(String.Format("<tr><td>{0}</td><td>{1}</td></tr>", "Request.Browser.Browser", Request.Browser.Browser)); | |
Response.Write(String.Format("<tr><td>{0}</td><td>{1}</td></tr>", "Request.Browser.MajorVersion", Request.Browser.MajorVersion.ToString())); | |
%> | |
</table> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment