473,394 Members | 1,679 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

ConfigurationSetting.GetConfig() I don't get it

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
Nov 16 '05 #1
9 5038
"james" <no****@hypercon.net> schrieb
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
Nov 16 '05 #2
<?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
"Arne Janning" <sp*****************@msn.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
"james" <no****@hypercon.net> schrieb
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

Nov 16 '05 #3
Try adding it like this:

<configuration>

<configSections>
<section name="test" type="System.Configuration.DictionarySectionHandle r"
/>
</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
Nov 16 '05 #4
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
"Eric Cadwell" <ec******@ns.insight.com> wrote in message
news:Ow****************@tk2msftngp13.phx.gbl...
Try adding it like this:

<configuration>

<configSections>
<section name="test" type="System.Configuration.DictionarySectionHandle r"
/>
</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

Nov 16 '05 #5
>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
Nov 16 '05 #6
I didn't say it wasn't documented.

LOL

"Marc Scheuner [MVP ADSI]" <m.********@inova.SPAMBEGONE.ch> wrote in message
news:5q********************************@4ax.com...
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

Nov 16 '05 #7
>I didn't say it wasn't documented.

You said:
The documentation on ConfigurationSetting.GetConfig says ABSOLUTLEY 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
Nov 16 '05 #8
Well, if you take a look at ConfigurationSetting.GetConfig in the
documentation, it really does say nothing. Sorry.

JIM

"Marc Scheuner [MVP ADSI]" <m.********@inova.SPAMBEGONE.ch> wrote in message
news:j2********************************@4ax.com...
I didn't say it wasn't documented.
You said:
The documentation on ConfigurationSetting.GetConfig says ABSOLUTLEY

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

Nov 16 '05 #9
>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
Nov 16 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

303
by: mike420 | last post by:
In the context of LATEX, some Pythonista asked what the big successes of Lisp were. I think there were at least three *big* successes. a. orbitz.com web site uses Lisp for algorithms, etc. b....
16
by: mike420 | last post by:
Tayss wrote: > > app = wxPySimpleApp() > frame = MainWindow(None, -1, "A window") > frame.Show(True) > app.MainLoop() > Why do you need a macro for that? Why don't you just write
12
by: AFN | last post by:
I am running the code below to generate XML from a data table. But some fields in the data table are Null for every record. Suppose field5 has a null database value. I would expect to see: ...
1
by: kosta | last post by:
hello! I have this code: public static DataSet DSet(String sql) { OleDbConnection con = new OleDbConnection(); con.ConnectionString = ConfigurationSettings.AppSettings; OleDbCommand cmd =...
2
by: Mythran | last post by:
public static void Main() { string sectionName = "system.web"; object settings = ConfigurationSettings.GetConfig(sectionName); Console.WriteLine( settings == null ? "(null)" :...
19
by: LP | last post by:
I am using (trying to) CR version XI, cascading parameters feature works it asks user to enter params. But if page is resubmitted. It prompts for params again. I did set...
2
by: J Holsinger | last post by:
In VB.Net solution I have Standard Windows app and a Web app that references a Class library. Both the Win app and the class library use the same technique in the code files for retrieving...
0
by: Steph | last post by:
hello, in .NET1 i used this command for read a specific xml file config: ConfigurationSettings.GetConfig how to make in .NET 2 ? keep in mind : i need to read a specific file not the wep.config...
2
by: Glenn | last post by:
Hi Anyone know the equivalent to NameValueCollection nvc = ConfigurationSettings.GetConfig( "SectionGroup/Section" ) as NameValueCollection; in .Net 2.0. All the examples I've seen involve...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.