いろいろ試行錯誤

調べものしたときの覚書きや、仕事でコーディングした時のメモ などなど…

サーバ変数のコレクション一覧を表示する

int loop1, loop2;
System.Collections.Specialized.NameValueCollection coll = Request.ServerVariables;
string txt = "";
String arr1 = coll.AllKeys;
for (loop1 = 0; loop1 < arr1.Length; loop1++)
{
    txt += "Key: " + arr1[loop1] + "\n";
    String arr2 = coll.GetValues(arr1[loop1]);
    for (loop2 = 0; loop2 < arr2.Length; loop2++)
    {
        txt += "Value " + loop2 + ": " + Server.HtmlEncode(arr2[loop2]) + "\n";
    }
}
Logger.Logger.Debug("[Page_PreLoad] " + txt);