Recently I’ve encountered a problem where I had to dynamically insert new configuration sections to Microsoft’s Configuration Application Block.
At first glance this seems impossible but digging further into the application block’s code I found it could be easily done
using the following code:
ConfigurationSectionData newSection =
new ConfigurationSectionData(“NewSectionName”, false,
new XmlFileStorageProviderData(“Xml provider”, “someFile.xml”),
new XmlSerializerTransformerData());
ConfigurationSettings settings = ConfigurationManager.GetCurrentContext().GetMetaConfiguration();
settings.ConfigurationSections.Add(newSection);
ConfigurationManager.WriteConfiguration(“NewSectionName”, _settings);
Similar Posts:
- Developing a Robust Data Driven UI Using WPF – An Overdue Summary (and full source code)
- Microsoft calls OpenID a De Facto Login Standard
- Moving Your Application to Amazon’s Cloud
- Building an iPhone Application
- Why Coming Up With an iPhone Killer Will Be Tough…


Leave a Comment