configurationsection

How do I save custom configuration sections during runtime?

穿精又带淫゛_ 提交于 2019-12-11 04:33:56
问题 My application allows the user to add additional items to a combobox that get saved in a custom configuration section. The issue is that the save() call fails because my app is installed to C:/Program Files... which do not have read-write permissions so the user must run my app as Administrator. Is there a more skillful way of saving user-added UI elements that persist? I looked into user settings but it doesn't seem like there is a way to save collections. 回答1: .NET doesn't really support

How to read system.webserver configuration section?

爷,独闯天下 提交于 2019-12-08 15:45:02
问题 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 my code looks like... authSection = WebConfigurationManager.GetSection("system.webServer/security/authorization", HttpContext.Current.Request.Path) 回答1: Configuration webConfig = WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath);

Loop through the configrationsection to read it's elements using C#

社会主义新天地 提交于 2019-12-05 10:53:08
问题 I have a configuration file, something like: <logonurls> <othersettings> <setting name="DefaultEnv" serializeAs="String"> <value>DEV</value> </setting> </othersettings> <urls> <setting name="DEV" serializeAs="String"> <value>http://login.dev.server.com/Logon.asmx</value> </setting> <setting name="IDE" serializeAs="String"> <value>http://login.ide.server.com/Logon.asmx</value> </setting> </urls> <credentials> <setting name="LoginUserId" serializeAs="String"> <value>abc</value> </setting>

Can I specify a range with the IntegerValidator attribute on a custom ConfigurationSection?

懵懂的女人 提交于 2019-12-05 03:55:25
I have a class containing the following ConfigurationSection : namespace DummyConsole { class TestingComponentSettings: ConfigurationSection { [ConfigurationProperty("waitForTimeSeconds", IsRequired=true)] [IntegerValidator(MinValue = 1, MaxValue = 100, ExcludeRange = false)] public int WaitForTimeSeconds { get { return (int)this["waitForTimeSeconds"]; } set { this["waitForTimeSeconds"] = value; } } [ConfigurationProperty("loginPage", IsRequired = true, IsKey=false)] public string LoginPage { get { return (string)this["loginPage"]; } set { this["loginPage"] = value; } } } } I then have the

Adding custom attributes to Custom Provider Configuration Section in app.config

拥有回忆 提交于 2019-12-04 14:00:06
问题 I am following this great article on how to create a Provider framework in .NET Basically, this article explains greatly how to end up with a configuration file like the following: <configuration> <configSections> <section name="data" type="DataProviderConfigurationSection" /> </configSections> <data defaultProvider="MyDataProvider"> <providers> <add name="MydataProvider" type="MyDataProvider" /> </providers> </data> </configuration> Where the <add/> element allows you to define a provider.

Sections must only appear once per config file! why?

社会主义新天地 提交于 2019-12-03 16:09:59
I'm getting the following exeption: "Sections must only appear once per config file. See the help topic for exceptions. " my configuration file look like this : <configSections> <sectionGroup name="point.System"> <section name="singleInstanceCache" type="xyz.Point.System.Configuration.SingleInstanceCache, Point.System" /> </sectionGroup> <sectionGroup name="point.Services"> <sectionGroup name="xServices" type="xyz.Point.Messaging.PointServiceConfiguration.PointServices, Barcap.FIA.Point.Messaging"> <section name="xService" type="xyz.Point.Messaging.PointServiceConfiguration.PointService,

Adding custom attributes to Custom Provider Configuration Section in app.config

只愿长相守 提交于 2019-12-03 08:56:50
I am following this great article on how to create a Provider framework in .NET Basically, this article explains greatly how to end up with a configuration file like the following: <configuration> <configSections> <section name="data" type="DataProviderConfigurationSection" /> </configSections> <data defaultProvider="MyDataProvider"> <providers> <add name="MydataProvider" type="MyDataProvider" /> </providers> </data> </configuration> Where the <add/> element allows you to define a provider. However, I would like to know how to extend the add entry with custom attributes. For example:

Intellisense for custom config section problem with namespaces

↘锁芯ラ 提交于 2019-12-01 18:04:36
问题 I have just rolled a custom configuration section, created an accompanying schema document for Intellisense and added it to the Web.config's Schemas property as per Michael Stum's answer to another similar question. Unfortunately, and possibly due to me creating the XSD by hand with limited knowledge, the Intellisense relies on an xmlns attribute pointing to my XSD file's namespace being present in the custom config element. However, when running the project I get an Unrecognized attribute

How do I use .NET custom ConfigurationElement properties on descendent elements?

醉酒当歌 提交于 2019-12-01 04:21:40
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 this: <CustomSettings someProperty="foo"> <CustomSetting key="bar" value="fermeneba" /> <CustomSetting key="laa" value="jubaduba" /> </CustomSettings> I have the code working, except that I cannot find a way to access the someProperty attribute from the CustomSetting class. The only way that I've found, so far, is to format the configuration like this, which

How do I use .NET custom ConfigurationElement properties on descendent elements?

我怕爱的太早我们不能终老 提交于 2019-12-01 02:29:09
问题 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 this: <CustomSettings someProperty="foo"> <CustomSetting key="bar" value="fermeneba" /> <CustomSetting key="laa" value="jubaduba" /> </CustomSettings> I have the code working, except that I cannot find a way to access the someProperty attribute from the