Represents a section within a configuration file.
Questions tagged [configurationsection]
122 questions
71
votes
8 answers
How to get the values of a ConfigurationSection of type NameValueSectionHandler
I'm working with C#, Framework 3.5 (VS 2008).
I'm using the ConfigurationManager to load a config (not the default app.config file) into a Configuration object.
Using the Configuration class, I was able to get a ConfigurationSection, but I could not…

Liran B
- 711
- 1
- 5
- 4
65
votes
2 answers
How do you use sections in c# 4.0 app.config?
I want to use my app config to store the settings for 2 companys, and i'd prefer if it was possible to use a section to seperate the data for one from the other rather then giving them diffrent key names.
I have been checking online but i seem to…

Andy
- 2,248
- 7
- 34
- 57
56
votes
8 answers
Can't load a manifest resource with GetManifestResourceStream()
I've created a custom configuration section using XSD. In order to parse the config file that follows this new schema, I load the resource (my .xsd file) with this:
public partial class MonitoringConfiguration
{
public const string…

Amokrane Chentir
- 29,907
- 37
- 114
- 158
48
votes
2 answers
Correct implementation of a custom config section with nested collections?
In a web application, I want to be able to define some mapping using a config section like this:

Steve B
- 36,818
- 21
- 101
- 174
23
votes
1 answer
TimeSpan of days in configuration?
It appears that ConfigurationElement of TimeSpan can't handle values larger than 23:59:59. Are there any workarounds? Is subclassing TimeSpan, and making a new TimeSpanValidatorAttribute even going to work? I need to handle timespans from a few…

BozoJoe
- 6,117
- 4
- 44
- 66
16
votes
3 answers
ConfigurationProperty is inaccessible due to its protection level
I wanna read/write (and save) application's configuration file in program
The app.config is like this:

Mark Ma
- 1,342
- 3
- 19
- 35
14
votes
5 answers
Custom Configuration, ConfigurationElements, and ConfigurationProperties
I've been scouring the net for the last 3 days, and can't find any reference to this question. I've created a custom configuration class to be used with my app.config. Everything works fine. The problem comes in when a configuration property (of a…

user62064
- 185
- 1
- 3
- 10
14
votes
1 answer
How to read system.webserver configuration section?
Is there any 'nice' way to read configuration section group of IIS7 by using WebConfigurationManager o anything?
I tried to read the authorization section but WebConfigurationManager.GetSection() returns an 'IgnoredSection' instance.
This is what…

Maxolidean
- 477
- 6
- 18
13
votes
1 answer
custom ConfigurationSection
I use IConfigurationSectionHandler interface to get information about my custom config section. But it's deprecated and I want to use ConfigurationSection instead.
How to create custom ConfigurationSection with this view and using…

Timur Mustafaev
- 4,869
- 9
- 63
- 109
13
votes
1 answer
How to get all sections by name in the sectionGroup applicationSettings in .Net 2.0
Here's the idea I had:
I want a small executable to have an app.config file with multiple sections that are situated under the sectionGroup "applicationSettings" (not "appSettings", I don't need to write to the file). Each section would have a name…

HaMster
- 533
- 1
- 6
- 17
11
votes
3 answers
Loading a ConfigurationSection with a required child ConfigurationElement with .Net configuration framework
I have a console application that is trying to load a CustomConfigurationSection from a web.config file.
The custom configuration section has a custom configuration element that is required. This means that when I load the config section, I expect…

Vadim Rybak
- 1,677
- 20
- 25
10
votes
2 answers
ConfigurationSection ConfigurationManager.GetSection() always returns null
I am trying to learn how to use the ConfigurationSection class. I used to use the IConfigurationSectionHandler but released that it has been depreciated. So being a good lad I am trying the "correct" way. My problem is that it is always returning…

Jon
- 15,110
- 28
- 92
- 132
8
votes
1 answer
Can I specify a range with the IntegerValidator attribute on a custom ConfigurationSection?
I have a class containing the following ConfigurationSection:
namespace DummyConsole {
class TestingComponentSettings: ConfigurationSection {
[ConfigurationProperty("waitForTimeSeconds", IsRequired=true)]
[IntegerValidator(MinValue = 1,…

Zhaph - Ben Duguid
- 26,785
- 5
- 80
- 117
7
votes
1 answer
How do I use .NET custom ConfigurationElement properties on descendent elements?
How can I get and use an attribute set in the parent ConfigurationSection in the descendent CustomSetting element? I need this attribute when the CustomSetting element is returning the Value property.
I want to format the App.config like…

Jeremy Gaither
- 118
- 1
- 7
7
votes
2 answers
How to parse json settings in appsettings.json into a class in c# .netcore
I have a appsettings.json that look like this
{
"AppName": "my-app-service",
"MyModel": {
"MyList": [{
"CountryCode": "jp"
},{
"CountryCode": "us"
}]
}
}
Now, i have a POCO file, (MyList.cs is ommited, it has a single…

Zhen Liu
- 7,550
- 14
- 53
- 96