Hi guys,
I've got a problem under reading settlings from App.config file.
I've used System.Configuration to reach to the "User Settings" and
"Application Settings" sections.
the problem is now I'm not able read the property defined under this
section. those are like this
User Settings -Testing
Application Settings -Test
those properties are getting read by the application if i use "Default
Properties" object. but i want to read them through my code.
here is the code i used:
foreach (ConfigurationSection section in
c.SectionGroups["usersettings"].Sections)
{
System.Diagnostics.Debug.WriteLine(section.Section Information.ToString());
}
XML from App.Config.
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="userSettings"
type="System.Configuration.UserSettingsGroup, System, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="TestProject.Properties.Settings"
type="System.Configuration.ClientSettingsSection, System,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
<sectionGroup name="applicationSettings"
type="System.Configuration.ApplicationSettingsGrou p, System,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="TestProject.Properties.Settings"
type="System.Configuration.ClientSettingsSection, System,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
requirePermission="false" />
</sectionGroup>
</configSections>
<userSettings>
<TestProject.Properties.Settings>
<setting name="testing" serializeAs="String">
<value>testing</value>
</setting>
</TestProject.Properties.Settings>
</userSettings>
<applicationSettings>
<TestProject.Properties.Settings>
<setting name="test" serializeAs="String">
<value>test</value>
</setting>
</TestProject.Properties.Settings>
</applicationSettings>
</configuration>
Please let me know if someone out there has any experience on this.
I would appreciate any help.
thanks,
Lucky