Click here to Skip to main content
15,891,763 members
Articles / Web Development / ASP.NET

Read Sections from web.config Not Located in Root

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
23 Feb 2013CPOL 14.2K   7  
This tip explains how to keep application settings classified by sections in another config file.
<?xml version="1.0"?>
<configuration>
  <configSections>
    <!--The following code declares a section group called Group1. -->
    <sectionGroup name="Group1">
      <section name="Section1"
       type="System.Configuration.NameValueSectionHandler" />
      <section name="Section2"
       type="System.Configuration.NameValueSectionHandler" />
    </sectionGroup>
  </configSections>

  <Group1>
    <Section1>
      <add key="Setting1" value="value1" />
      <add key="Setting2" value="value2" />
    </Section1>
    <Section2>
      <add key="Setting1" value="value12" />
      <add key="Setting2" value="value22" />
    </Section2>
  </Group1>
</configuration>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Systems Engineer TCS
India India
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions