Welcome to mirror list, hosted at ThFree Co, Russian Federation.

index.aspx « subdir « twolevel « configuration « standalone « Test « System.Web « class « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d1e67a63f6009bf29da81128d5e392c3a1733c26 (plain)
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<%@ Page Language="C#" %>
<%@ Import namespace="System.Web.Configuration" %>

<script runat="server">

void Page_Load ()
{
	string value = "";
	System.Configuration.Configuration c = WebConfigurationManager.OpenWebConfiguration("/toshok/configuration/twolevel");
	lbl.Text = String.Format ("{0} (c.FilePath = {1}", c.AppSettings.Settings["testSetting"].Value, c.FilePath);
	lbl2.Text = WebConfigurationManager.AppSettings["testSetting"];

	object s = WebConfigurationManager.GetSection ("appSettings");
	if (s is NameValueCollection) {
		NameValueCollection col = (NameValueCollection)s;
		value = String.Format ("{0} (section type = NameValueCollection)", col["testSetting"]);
	}
	else if (s is AppSettingsSection) {
		AppSettingsSection sect = (AppSettingsSection)s;
		value = String.Format ("{0} (section type = AppSettingsSection)", sect.Settings["testSetting"].Value);
	}
	lbl3.Text = value;

	s = WebConfigurationManager.GetSection ("appSettings", "/toshok/configuration/twolevel");
	if (s is NameValueCollection) {
		NameValueCollection col = (NameValueCollection)s;
		value = String.Format ("{0} (section type = NameValueCollection)", col["testSetting"]);
	}
	else if (s is AppSettingsSection) {
		AppSettingsSection sect = (AppSettingsSection)s;
		value = String.Format ("{0} (section type = AppSettingsSection)", sect.Settings["testSetting"].Value);
	}
	lbl4.Text = value;
}

</script>

<table>
<tr><td>WebConfigurationManager.OpenWebConfiguration <td><asp:Label id="lbl" runat="server" /></tr>
<tr><td>WebConfigurationManager.AppSettings <td><asp:Label id="lbl2" runat="server" /> </tr>
<tr><td>WebConfigurationManager.GetSection(string) <td><asp:Label id="lbl3" runat="server" /> </tr>
<tr><td>WebConfigurationManager.GetSection(string,string) <td><asp:Label id="lbl4" runat="server" /> </tr>
</table>