problem about system.configuration-Collection of common programming errors
iammichael
c# .net multithreading 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 library documentation, are annotated with the following thread-safety information:Any public static (Shared in Visual Basic) members of this type are thread safe. An
gyurisc
.net configurationsection system.configuration
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>(string key, out T value);bool TrySet<T>(string key, T value); }At runtime, I can say something like: My.Foo.Data data = new My.Foo.Data(“blabla”); Pref pref =
John
asp.net encryption web-config aspnet-regiis.exe system.configuration
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″><configSections><section name=”MyCustomSection” type=”MyNamespace.MyCustomSectionHandler, MyAssembly”/></configSections> <configProtectedData><providers><clear /><ad
abatishchev
c# app-config configurationsection system.configuration xml-formatting
I have custom ConfigurationSection and call Configuration.Save() after some modifications against it:var config = ConfigurationManager.OpenMappedExeConfiguration(new ExeConfigurationFileMap() { ExeConfigFilename = “My.config” },ConfigurationUserLevel.None); if (config != null) {// do stuffconfig.Save(); }Currently it performs some formatting of resulting XML. For example, replaces tabs with spaces, inserts line-breaks if it thinks that it’s too long (> ~130 characters), etc.How can I preserve or
hwiechers
c# .net system.configuration
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 this error:The value for the property ‘x’ is notvalid. The error is: The string mustbe at least 1 characters long.It works if I change the configuration property to include a
Web site is in building