I'm writing a page that can use a couple of different themes, and I'm going to store some information about each theme in the web.config.
Is it more efficient to create a new sectionGroup and store everything together, or just put everything in appSettings?
configSection solution
<configSections>
<sectionGroup name="SchedulerPage">
<section name="Providers" type="System.Configuration.NameValueSectionHandler"/>
<section name="Themes" type="System.Configuration.NameValueSectionHandler"/>
</sectionGroup>
</configSections>
<SchedulerPage>
<Themes>
<add key="PI" value="PISchedulerForm"/>
<add key="UB" value="UBSchedulerForm"/>
</Themes>
</SchedulerPage>
To access values in the configSection, I am using this code:
NameValueCollection themes = ConfigurationManager.GetSection("SchedulerPage/Themes") as NameValueCollection;
String SchedulerTheme = themes["UB"];
appSettings solution
<appSettings>
<add key="PITheme" value="PISchedulerForm"/>
<add key="UBTheme" value="UBSchedulerForm"/>
</appSettings>
To access values in appSettings, I am using this code
String SchedulerTheme = ConfigurationManager.AppSettings["UBSchedulerForm"].ToString();