Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8685373
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T22:33:15+00:00 2026-06-12T22:33:15+00:00

I have a customized config section in my web.config like this: <configSection> <section name=CustomConfig

  • 0

I have a customized config section in my web.config like this:

     <configSection>
            <section name="CustomConfig" type="ConfigSectionRoot" allowLocation="true" allowDefinition="Everywhere"/>
        </configSection>


    <CustomConfig>
    <ConfigRoot>
        <add key="DataBase" value="CouchDB"/>
        <add key="FrontEnd" value="Asp.Net"/>
        <add key="AppName" value="Virtual WorkPlace"/>
      </ConfigRoot>
    </CustomConfig>

<AppSettings>
<add key="DataBase" value="CouchDB"/>
</AppSettings>

My ConfigSectionRoot.cs is like this:

public class ConfigSectionRoot:ConfigurationSection
    {

        [ConfigurationProperty("key", DefaultValue = "", IsKey = true, IsRequired = true)]
        public string Key
        {
            get
            {
                return ((string)(base["key"]));
            }
            set
            {
                base["key"] = value;
            }
        }

        [ConfigurationProperty("value", DefaultValue = "", IsKey = false, IsRequired = false)]
        public string Value
        {
            get
            {
                return ((string)(base["value"]));
            }
            set
            {
                base["value"] = value;
            }
        }
    }

If i use AppSettings Instead of Custom Config I could access it like:

string results= ConfigurationManager.AppSettings["Database"];
// results wil contain "CouchDB"

Is there any way to achieve the same thing in Customized Config section ??? Pls help me out

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T22:33:17+00:00Added an answer on June 12, 2026 at 10:33 pm

    NameValueSectionHandler

    If your configuration doesn’t need to be more than a key-value store, I’d go for a NameValueSectionHandler.

    <section name="customConfig" type="System.Configuration.NameValueSectionHandler"/>
    <!-- ... -->
    <customConfig>
      <add key="DataBase" value="CouchDB" />
      <add key="FrontEnd" value="Asp.Net" />
      <add key="AppName" value="Virtual WorkPlace" />
    </customConfig>
    

    You can then read it out, just like the appSettings:

    var customConfig = (System.Collections.Specialized.NameValueCollection)System.Configuration.ConfigurationManager.GetSection("customConfig");//i have changed like this and it worked fine
    var database = customConfig["DataBase"];
    

    SingleTagSectionHandler

    You could also achieve the same with a SingleTagSection:

    <section name="customConfig" type="System.Configuration.SingleTagSectionHandler"/>
    <!-- ... -->
    <customConfig database="CouchDB" frontEnd="Asp.Net" appName="Virtual Workplace" />
    

    And then query it with:

    var customConfig = (System.Collections.Hashtable) System.Configuration.ConfigurationManager.GetConfig("customConfig");
    var database = customConfig["database"];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have found and customized this JQuery script, which displays different content when different
I have a component library. It has a manifest file that looks like this:
I have a web app of which I would like to create a mobile
Let's imagine we have some script 'm12' (I've just invented this name) that runs
I have customized the UIAlertView class. It's working perfectly. I don't want the bounce
In my magento project the search result not displays. I have customized my magento.
I have a customized show/hide toggle script that I'm using along with CSS3 transitions
I have a customized version of SDL 1.2 and pygame 1.9.1 that implement SDL2's
Currently I have a customized people picker in sharepoint 2010, it searches the search
I am using SharePoint 2010 and have a customized newform.aspx and editform.aspx that I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.