Create new section handeler for your new config section (implement IConfigurationSectionHandler interface)public class CustomConfiguration : IConfigurationSectionHandler
{
public object Create(object parent, object input, XmlNode node)
{
/// add your logic here ...
return new object();
}
}
Add a reference to your new config section and register it with the assembly
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<configSections>
<section name="customConfiguration" type="Root.Client.Configuration.CustomConfiguration, Root.Client.Configuration" />
....
</configSections>
<customConfiguration>
.....
// your custom configuration
.....
<customConfiguration>
</configuration>
Set custom configuration section in application start event(global.ascx) and add it to the cachepublic override void Application_Start(object sender, EventArgs e)
{
HttpContext.Current.Cache.Insert("CustomConfiguration", System.Configuration.ConfigurationSettings.GetConfig("customConfiguration") as CustomConfiguration);
}