A year out of date I know, but I used this method to read each of the settings:
Configuration config = ConfigurationManager.OpenExeConfiguration(Assembly.GetExecutingAssembly().Location);
ConfigurationSectionGroup csg = config.GetSectionGroup("applicationSettings");
ClientSettingsSection c = (ClientSettingsSection)csg.Sections["Add your section name here, e.g. Your.Namespace.Properties.Settings"];
foreach (SettingElement e in c.Settings)
{
Debug.WriteLine("SETTING NAME: " + e.Name);
SettingValueElement v = e.Value;
Debug.WriteLine("SETTING VALUE: " + v.ValueXml.InnerText);
}
This works on a settings file created in a Class Library Project. The settings file should be named "YourLibrary.dll.config" and then deployed in the library's location. The settings file should have similar content to this:
<?xml version="1.0"?>
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="Your.NameSpace.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
</sectionGroup>
</configSections>
<applicationSettings>
<Your.NameSpace.Properties.Settings>
<setting name="YourLibrary_WebReferences_YourWebService" serializeAs="String">
<value>http://localhost:3861/YourWebService.asmx</value>
</setting>
<setting name="AnotherSetting" serializeAs="String">
<value>False</value>
</setting>
</Your.NameSpace.Properties.Settings>
</applicationSettings>
<startup>
<supportedRuntime version="v2.0.50727"/>
</startup>
</configuration>
I haven't needed to read connection strings from the config file, but that should be possible by changing the name of the section group that you get after opening the exe configuration.
The reason why I needed to do this is that I have a User Control which wraps a ActiveX/COM library which is then hosted in IE in an "object" tag. I have got the use of "param" tags working, so I could have used that mechanism to have passed the settings into the User Control, but this method seemed a logical choice at the time. Plus I wasn't going to let this particular problem beat me!
HTH pridmorej :)