system.configuration

Need to create a dynamic ConfigurationSection that also holds the type

I need to create a configuration section, that is able to store key-value pairs in an app.config file and the key-value pairs can be added runtime regardless of their type. It is also important that the value keeps its original type. I need to extend the following interface public interface IPreferencesBackend { bool TryGet<T>(stri...

How to load back a dynamically created settingsproperty next time

I created a way to dynamically add settingsproperty to a .net app.config file. It all works nic, but when I am launching my app the next time I can only see the properties that are created in the designer. How can I load back the properties runtime. My code for creating the settingsproperty looks the following: internal void CreatePro...

WCF and System.Configuration namespace

I received an error when an referenced .NET Framework 2.0 assembly tried to execute the following line of code in an IIS hosted WCF service: Error Message: exePath must be specified when not running inside a stand alone exe. Source Code: ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); Has anyone experi...

HowTo: Detect .Net Configuration Section instance without Loading into memory?

Does anyone know how to detect if an instance of a configuration section exists in a .net configuration file without actually having to load the configuration section into memory, and without having to parse the xml file manually - ie, using the System.Configuration namespace. I have tried using System.Configuration.ConfigurationManager...

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 burdensome? System.Configuration classes, like most (all?) other classes in Microsoft's .Net li...

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: <?xml version="1.0"?> <configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0"&gt; <configSections> <section...

System.configuration web.config and app.config

While using a third party dll I was getting the following exception - "exePath must be specified when not running inside a stand alone exe" with following trace System.Configuration.ConfigurationManager.OpenExeConfigurationImpl(ConfigurationFileMap fileMap, Boolean isMachine, ConfigurationUserLevel userLevel, String exePath). The reaso...

Change setting within a "ClientSettingsSection" with C#

Is it possible to change values of settings within a ClientSettingsSection (System.Configuration.ClientSettingsSection) in a exe-configuration? Unfornately the settings in the ClientSettingsSection collection are read-only ! ...

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: YourConfigElement config = ConfigurationManager.GetSection("YourSectionName") as YourConfi...

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 am more prone to use ConfigurationManage.AppSettings.Get(). Looking at the internals, App...

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 { this["x"] = value; } } Now I add my section like this: <mySection x="123" /> I'll get...

How to send a System.Configuration.Configuration object trough WCF

Well I think the title explains for itself. I'm trying to export a configuration object trough the wire, but it looks quite difficult, the class is not serializable and... it's sealed, so no heritage here. As anyone did something like this before? Regards ...