NinethSense oWnZ mE!: Praveen’s drawing book

Choose a Topic:

Fri
2
Nov '07

List Server Varilables with ASP.NET

Here is the code which will list all the available server variables. (a typical subset of phpinfo() ;) )

File: ServVars.aspx
< %@ Page Language=“C#” %>
 
< !DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
 
<script runat=“server”>
 
    protected void Page_Load(object sender, EventArgs e)
    {
        int i = 0;
        foreach (string s in Request.ServerVariables)
        {
            Response.Write((++i).ToString() + “. “ +s +” = “ + Request.ServerVariables[s] + “<hr />”);
        }
    }
</script>
 
<html xmlns=“http://www.w3.org/1999/xhtml” >
<head runat=“server”>
    <title>Untitled Page</title>
</head>
<body>
    <form id=“form1″ runat=“server”>
    <div>
    
    </div>
    </form>
</body>
</html>
The CodeProject Microsoft Developer Network Official ASP.NET Forums Microsoft .NET Framework Community Microsoft Most Valuable Professional Kidoos forums Microsoft Visual Studio Developer Home Professional Information Technology Solutions Microsoft Research Home Kerala Microsoft Users Group Community Website