Add a reference to your new config section and register it with the assembly
public class CustomConfiguration : IConfigurationSectionHandler { public object Create(object parent, object input, XmlNode node) { /// /// add your logic here ... /// return new object(); } }
Set custom configuration section in application start event(global.ascx) and add it to the cache
<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>
public override void Application_Start(object sender, EventArgs e) { HttpContext.Current.Cache.Insert("CustomConfiguration", ConfigurationSettings.GetConfig("customConfiguration") as CustomConfiguration); }
No comments:
Post a Comment