Skip to content

Instantly share code, notes, and snippets.

@klpatil
Last active January 29, 2020 17:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save klpatil/d4c5d242b715ac8c6213366e85be585c to your computer and use it in GitHub Desktop.
Save klpatil/d4c5d242b715ac8c6213366e85be585c to your computer and use it in GitHub Desktop.
Geolocation test
<script runat="server">
private void PrintInfo() {
Response.Write("Country " + Sitecore.Analytics.Tracker.Current.Interaction.GeoData.Country);
Response.Write("<br/>");
Response.Write("AreaCode " + Sitecore.Analytics.Tracker.Current.Interaction.GeoData.AreaCode);
Response.Write("<br/>");
Response.Write("City " + Sitecore.Analytics.Tracker.Current.Interaction.GeoData.City);
Response.Write("<br/>");
Response.Write("XFWFOR " + HttpContext.Current.Request.Headers["X-Forwarded-For"]);
Response.Write("<br/>");
NameValueCollection headers = HttpContext.Current.Request.Headers;
for (int i = 0; i < headers.Count; i++)
{
string key = headers.GetKey(i);
string value = headers.Get(i);
Response.Write(key + " = " + value + "<br/>");
}
foreach (string var in Request.ServerVariables)
{
Response.Write(var + " " + Request[var] + "<br>");
}
}
</script>
<ul>
<%
PrintInfo();
%>
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment