app.config

S

Stefano Meier

I have tried the example on the following url but it has given me an error

http://msdn.microsoft.com/library/en-us/cpguide/html/cpcondeclaringsectiongroups.asp

the app.config file is:

<configuration>
<configSections>
<section name="sampleSection"
type="System.Configuration.SingleTagSectionHandler" />
<!--The following code declares a section group called
mySectionGroup. -->
<sectionGroup name="mySectionGroup">
<section name="mySection"
type="System.Configuration.NameValueSectionHandler,System" />
</sectionGroup>
</configSections>

<mySectionGroup>
<mySection>
<add key="key1:value1" />
</mySection>
</mySectionGroup>
</configuration>

And in code the following line generate the error:
System.Configuration.NameValueSectionHandler, system could not be provided

NameValueCollection nvc = (NameValueCollection)
ConfigurationSettings.GetConfig("mySectionGroup/mySection");

Any idea why doesn't work?
 
F

Fabio Luiz Paranhos Borelli

Try this:

<mySectionGroup>
<mySection>
<add key="key1" value="value1" />
</mySection>
</mySectionGroup>

[]´s Fabio

-----Original Message-----

I have tried the example on the following url but it has given me an error

http://msdn.microsoft.com/library/en- us/cpguide/html/cpcondeclaringsectiongroups.asp

the app.config file is:

<configuration>
<configSections>
<section name="sampleSection"
type="System.Configuration.SingleTagSectionHandler" />
 
J

Jay B. Harlow [MVP - Outlook]

Stefano,
Removing ",System" from the type on mySection I got your sample to work.

Also if I give the fully qualified name I got your sample to work.
<section name="mySection"
type="System.Configuration.NameValueSectionHandler,System,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"" />

I'm sure I had a sample where giving just ", System" succeeded, now I cannot
find it...

Hope this helps
Jay
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top