Custom section in config file problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • valdas
    New Member
    • Dec 2009
    • 1

    Custom section in config file problem

    Hi,

    I have a problem in accessing "sqlServerCatal ogNameOverwrite s" section in app.config file.

    Code:
    <configuration>
      <configSections>
        <section name="sqlServerCatalogNameOverwrites"  type="System.Configuration.NameValueSectionHandler" />
      </configSections>
    
      <sqlServerCatalogNameOverwrites>
        <add key="ISDev17" value="ISDev18" />
      </sqlServerCatalogNameOverwrites>
    </configuration>
    Third party software requires such configuration which i need to modify programatically .

    I've tried
    Code:
    ConfigurationManager.GetSection("sqlServerCatalogNameOverwrites")
    but this accesses readonly configuration information.


    I've also tried

    Code:
    Configuration config = ConfigurationManager.OpenExeConfiguration (ConfigurationUserLevel.None);
    ConfigurationSection section = config.GetSection("sqlServerCatalogNameOverwrites");
    Now i'm in stuck accessing key-value pair.
    I should implement "ConfigurationS ection", "ConfigurationE lement", "ConfigurationP roperty" and point to my own type in config file.
    Problem is i can't change type, section type must be System.Configur ation.NameValue SectionHandler.

    Is any way to change the configuration?

    Any help is appreciated.
Working...