Questions tagged [system.configuration]

The System.Configuration is a .net framework namespace contains the types that provide the programming model for handling configuration data.

88 questions
37
votes
5 answers

Using ASPNet_Regiis to encrypt custom configuration section - can you do it?

I have a web application with a custom configuration section. That section contains information I'ld like to encrypt (was hoping to use ASPNet_RegIIS rather than do it myself). Web.Config:
37
votes
1 answer

How to Create a Configuration Section That Contains a Collection of Collections?

I need a configuration section something like this:
John Saunders
  • 160,644
  • 26
  • 247
  • 397
35
votes
8 answers

Where is ConfigurationManager's namespace?

I've got a reference to System.Configuration - and ConfigurationSettings is found no problem - but the type or namespace 'ConfigurationManager' could not be found!? I've read around - and it looks like it should belong to the same namespace as the…
user1017882
27
votes
2 answers
23
votes
6 answers

Get the App.Config of another Exe

I have an exe with an App.Config file. Now I want to create a wrapper dll around the exe in order to consume some of the functionalities. The question is how can I access the app.config property in the exe from the wrapper dll? Maybe I should be a…
Graviton
  • 81,782
  • 146
  • 424
  • 602
22
votes
3 answers

reading external configuration file

I have a c# .Net console app that performs FTP operations. Currently, I specify the settings in a custom configuration section, e.g.
Raymond
  • 3,382
  • 5
  • 43
  • 67
13
votes
4 answers

Why does ConfigurationValidator validate the default value of a ConfigurationProperty even if IsRequired is true?

Let's say I have a configuration property that looks like this. Note that there is no default value. [ConfigurationProperty("x", IsRequired = true)] [StringValidator(MinLength = 1)] public string X { get { return (string)this["x"]; } set {…
hwiechers
  • 14,583
  • 8
  • 53
  • 62
11
votes
1 answer

TypeLoadException

I am using the app.config file to store credentials and when I try to retrieve them, I get a TypeLoadException as follows : Could not load type 'System.Configuration.DictionarySectionHandler' from assembly 'System.Configuration, Version=4.0.0.0,…
Ex Menta
  • 113
  • 1
  • 5
10
votes
3 answers

Simple custom config section with collection in .NET4

I'm trying to write a very simple custom configuration section for a .NET4 application. My goal is this:
Ronald Wildenberg
  • 31,634
  • 14
  • 90
  • 133
10
votes
3 answers

ConfigurationElementCollection with a number of ConfigurationElements of different type

Is it possible to have a CollectionElementCollection with a number of different by type CollectionElements, e.g.:
abatishchev
  • 98,240
  • 88
  • 296
  • 433
9
votes
2 answers

Thread safe usage of System.Configuration

Is there an easy method of accessing custom System.Configuration-based configuration data through a thread-safe interface without requiring each execution context from loading/reloading configuration information which would be computationally…
iammichael
  • 9,477
  • 3
  • 32
  • 42
9
votes
2 answers

Benefits of .Net's AppSettingsReader vs ConfigurationManager for reading application configuration settings

Is there a substantial difference between the AppSettingsReader class and the AppSettings member of the ConfigurationManager class in .Net 3.5? I'm building out some legacy code and a previous developer used AppSettingsReader.GetValue(), whereas I…
cori
  • 8,666
  • 7
  • 45
  • 81
9
votes
1 answer

How to Create a Configuration Section That Contains a Collection

There is a great question and answer here that illustrates how to create a custom configuration section that is able to parse configuration of the following form into .Net objects:
Jeff G
  • 4,470
  • 2
  • 41
  • 76
7
votes
2 answers

Getting config element from ConfigurationElementCollection

I have (hopefully) setup ConfigurationElementCollection of my own design with emails as keys. Now what? Hard to find actually on the web. How do I: iterate through it? See if a specific element exists? get a specific element? ...given: …
Martin
  • 2,956
  • 7
  • 30
  • 59
6
votes
2 answers

How do you copy files into Azure Function bin folder?

Background: I have an Azure Function C# Project running in netcoreapp3.1 and azure version v3. Here's a snippet of the csproj... netcoreapp3.1
1
2 3 4 5 6