Other posts related to net

Display Environmental and Configuration Variables in .Net (C#)

January 14, 2010 9:10 pm

Here is a little script to display a bunch of environmental and configuration variables in .Net. They are formatted terribly but I’ll fix that eventually:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
protected void Page_Load(object sender, EventArgs e)
       {
           IDictionary variables = Environment.GetEnvironmentVariables();
           string[] drives = Environment.GetLogicalDrives();
           Response.Write("<strong>Environmentals</strong> <br>");
           foreach (DictionaryEntry var in variables)
           {
               Response.Write(var.Key + "~" + var.Value + "<br>");
           }
           Response.Write("<strong>Drives</strong> <br>");
           foreach (string drive in drives)
           {
               Response.Write(drive + "<br>");
           }
           Response.Write("<strong>AppSettings</strong> <br>");
           foreach (DictionaryEntry setting in ConfigurationManager.AppSettings)
           {
               Response.Write(setting.Key + "~" + setting.Value + "<br>");
           }
           Response.Write("<strong>ConnectionStrings</strong> <br>");
           foreach (ConnectionStringSettings setting in ConfigurationManager.ConnectionStrings)
           {
               Response.Write(setting.Name + "~" + setting.ConnectionString + "<br>");
           }
       }
Get Adobe Flash playerPlugin by wpburn.com wordpress themes