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

  • SEARCH
  • Home
  • 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 6102225
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:35:24+00:00 2026-05-23T13:35:24+00:00

Basically, App.config and Web.config are easy to deal with when it comes to connection

  • 0

Basically, App.config and Web.config are easy to deal with when it comes to connection strings and configuration key-value pairs.

But how to access additional sections of those two files?

The only way I can find implies that configuration/configSections/section must be created in order to be able to add additional settings to the configuration files. This is false, since several .NET components actually access custom settings without using configuration/configSections/section. For example, when dealing with diagnostics settings, I can have the section:

<system.diagnostics>
  <trace autoflush="true"/>
  <sources>
    <source name="Samples">
      <listeners>
        <add name="ConsoleListener" type="System.Diagnostics.ConsoleTraceListener"/>
      </listeners>
    </source>
  </sources>
</system.diagnostics>

without being required to add any configSection to the file.

How to do the same thing in my own code?

  • 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-05-23T13:35:25+00:00Added an answer on May 23, 2026 at 1:35 pm

    The section you mention isn’t undefined, it’s defined in the machine configuration file (which is global for .NET). If you need to have custom sections, you will need to define them in the beginning of the file and define the classes that represent them, so .NET knows how to handle the corresponding objects.

    If you only need to access some setting without getting the objects and everything, you can define the section as using just ConfigSectionHandler and then accessing the XML document directly like this (after all, the config file is just another XML file).

    I would strongly suggest to not go the direct access route and instead use the regular way, i.e. this guide. It will save you some trouble by validating everything and making it easily accessible from code. It is a PITA to set up initially, but it’s worth it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: App.Config Transformation for 'none web projects' in Visual Studio 2010? Basically, the
Basically my app is interacting with a web service that sends back a weird
well i basically cant add an app.config file to my win forms project. and
I'm using Castle Windsor with a configuration from my App.config file. In the code
my desired app.config would be like this: <configSections> <sectionGroup name=QA_Environment> <section name=databases type=System.Configuration.NameValueSectionHandler/> <section
Is it possible to set the app.config useLegacyV2RuntimeActivationPolicy parameter during runtime (basically before one
So my app is basically a shell with a ContentControl that I populate with
So I'm basically making an app that adds a count to a number and
I created a native Android app that basically hosts a webView control. That webView
I'm making a Android app that basically plays video from a website on the

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.