Skip to content

Instantly share code, notes, and snippets.

@javierguerrero
Created December 4, 2015 14:42
Show Gist options
  • Save javierguerrero/20dbcd795a89601fa1e9 to your computer and use it in GitHub Desktop.
Save javierguerrero/20dbcd795a89601fa1e9 to your computer and use it in GitHub Desktop.
int loop1, loop2;
// Load ServerVariable collection into NameValueCollection object.
var coll = Request.ServerVariables;
// Get names of all keys into a string array.
String[] arr1 = coll.AllKeys;
for (loop1 = 0; loop1 < arr1.Length; loop1++)
{
Response.Write("Key: " + arr1[loop1] + "<br>");
String[] arr2 = coll.GetValues(arr1[loop1]);
for (loop2 = 0; loop2 < arr2.Length; loop2++)
{
Response.Write("Value " + loop2 + ": " + Server.HtmlEncode(arr2[loop2]) + "<br>");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment