Geeks With Blogs

News My Blog has been MOVED to
Michael Freidgeim's OLD Blog My Blog has been MOVED to

I have a section in Web.Config:






I've tried to access inner section using shortcut “Section/Subsection“

string sSectionName="applicationSettings/FSBusinessLib.My.MySettings";
System.Configuration.ClientSettingsSection sectSettings = (ClientSettingsSection)config.Sections[sSectionName];

but it returned null.

The correct way is the following:

const string cnstApplicationSection = "applicationSettings";
ConfigurationSectionGroup grpApplicationSection = config.SectionGroups[cnstApplicationSection];
string sSectionName="FSBusinessLib.My.MySettings";
System.Configuration.ClientSettingsSection sectSettings = grpApplicationSection .Sections[sSectionName];

This approach is used in my ConfigurationHelper class

Posted on Friday, May 12, 2006 8:08 AM .Net Framework , Deployment | Back to top

Comments on this post: Using Configuration.Section to access subsection

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © Michael Freidgeim | Powered by: