ConfigurationSetting.GetConfig() I don't get it

  • Thread starter Thread starter james
  • Start date Start date
J

james

According to the documentation ConfigurationSetting.GetConfig( string ) is
used to get user defined config settings. Yet, no matter how I try to add
my own sections to the app.config I keep getting errors stating an invalid
config file section found. So, can someone elighten me as to how this is to
be used ??


thanks

JIM
 
james said:
According to the documentation ConfigurationSetting.GetConfig( string ) is
used to get user defined config settings. Yet, no matter how I try to add
my own sections to the app.config I keep getting errors stating an invalid
config file section found. So, can someone elighten me as to how this is
to
be used ??

Hi James,

could you please post your app.config so that it is easier for us to help
you.

Cheers

Arne Janning
 
<?xml version="1.0" ?>
<configuration>
<appSettings>
<add key="Application Name" value="xxxx" />
<add key="Version" value="v3.0" />
<add key="Author" value="yyyyy" />
<add key="Copyright" value="Copyright(c) xxxx" />
</appSettings>
</configuration>


so I tried adding

<TEST>
<add key="BLAH" value="BLAH" />
</TEST>

and I tried adding it in every possible location but I just get the error

JIM
 
Try adding it like this:

<configuration>

<configSections>
<section name="test" type="System.Configuration.DictionarySectionHandler"
/>
</configSections>

<appSettings>
<add key="Application Name" value="xxxx" />
<add key="Version" value="v3.0" />
<add key="Author" value="yyyyy" />
<add key="Copyright" value="Copyright(c) xxxx" />
</appSettings>

<test>
<add key="BLAH" value="BLAH" />
</test>

</configuration>


HTH;
Eric Cadwell
http://www.origincontrols.com
 
Eric,

Your a genius ! Now if I could only figure how you knew that. The
documentation on ConfigurationSetting.GetConfig says ABSOLUTLEY NOTHING
about this. And even when I read up on DictionarySectionHandler I still
cannot figure out tha the two go together.

thanks a lot

JIM
 
Your a genius ! Now if I could only figure how you knew that.

RTFM

The MSDN docs have TONS of stuff on how the .NET XML config files
work, and that you have to DECLARE your own sections, if you want to
use them.

Search your MSDN for "Configuration Files" in the ".NET Developer's
Guide", and READ IT - it has all the info right there, black on white.

Marc
================================================================
Marc Scheuner May The Source Be With You!
Bern, Switzerland m.scheuner(at)inova.ch
 
I didn't say it wasn't documented.

LOL

Marc Scheuner said:
RTFM

The MSDN docs have TONS of stuff on how the .NET XML config files
work, and that you have to DECLARE your own sections, if you want to
use them.

Search your MSDN for "Configuration Files" in the ".NET Developer's
Guide", and READ IT - it has all the info right there, black on white.

Marc
================================================================
Marc Scheuner May The Source Be With You!
Bern, Switzerland m.scheuner(at)inova.ch
 
I didn't say it wasn't documented.

You said:

That kinda sounds to me like you said just that - that it wasn't
documented - it *IS* documented, you just gotta find it and read it!
;-)

Marc
================================================================
Marc Scheuner May The Source Be With You!
Bern, Switzerland m.scheuner(at)inova.ch
 
Well, if you take a look at ConfigurationSetting.GetConfig in the
documentation, it really does say nothing. Sorry.

JIM

Marc Scheuner said:
I didn't say it wasn't documented.

You said:
NOTHING about this

That kinda sounds to me like you said just that - that it wasn't
documented - it *IS* documented, you just gotta find it and read it!
;-)

Marc
================================================================
Marc Scheuner May The Source Be With You!
Bern, Switzerland m.scheuner(at)inova.ch
 
Well, if you take a look at ConfigurationSetting.GetConfig in the
documentation, it really does say nothing. Sorry.

True - it assumes that you also read the relevant chapters in a
tutorial or book before embarking on a programming spree......

Sorry, but you just CANNOT have EVERYTHING documented EVERYWHERE - you
gotta also be able to do a bit of your own research when coming across
things like this.........

Marc
================================================================
Marc Scheuner May The Source Be With You!
Bern, Switzerland m.scheuner(at)inova.ch
 
Back
Top