csharp Loop through Server Variables

//<asp:literal runat="server" id="litServerVariables"></asp:literal>

System.Text.StringBuilder sb = new System.Text.StringBuilder();

sb.AppendLine("<table>");

System.Collections.IEnumerator en = Request.ServerVariables.Keys.GetEnumerator();
en.MoveNext();

foreach (string key in Request.ServerVariables.Keys)
{
	sb.AppendFormat("<tr><td>{0}</td><td>{1}</td></tr>", key, Request.ServerVariables[key]);
}
sb.AppendLine("</table>");

litServerVariables.Text = sb.ToString();
Loops through Server Variables and renders them within a literal.

Updated: Thursday 26th May 2011, 09:25am

There are 0 comments

Leave a comment of your own

Comments are currently closed.