views:

1452

answers:

1

I have the following web config file. I am having some difficulty in retrieving the value from the "AppName.DataAccess.ConnectionString" key. I know I could move it to the AppSetting block and get it realtively easily but I do not wnat to duplicate the key (and thereby clutter my already cluttered web.config file). Another DLL (one to which I have no source code) uses this block and since it already exists, why not use it.

I am a C# developer (using .Net 3.5) and this is VB code (using .Net 1.1 no less) so I am already in a strange place (where is my saftey semicolon?). Thanks for your help!!

<?xml version="1.0"?>
<configuration>
    <configSections>
     <section name="AppNameConfiguration" type="AppName.SystemBase.AppNameConfiguration, SystemBase"/>
    </configSections>
    <AppNameConfiguration>
     <add key="AppName.DataAccess.ConnectionString" value="(Deleted to protect guilty)" />
    </AppNameConfiguration>
    <appSettings>
        ...other key info deleted for brevity...
    </appSettings>
    <system.web>
     ...
     </system.web>
</configuration>
+2  A: 
<section name="AppNameConfiguration" 
type="AppName.SystemBase.AppNameConfiguration, SystemBase"/>

The custom section is supposed to have a class that defines how the various configuration data can be managed, (This is in the Type section). Is this class not available for you to examine?

MSDN has a decent explanation of how to create custom configuration sections in VB that may be helpful to you:

http://msdn.microsoft.com/en-us/library/2tw134k3.aspx

FlySwat