473,473 Members | 2,292 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

app.config


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

http://msdn.microsoft.com/library/en...tiongroups.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?
Nov 15 '05 #1
2 12516
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 " /> <!--The following code declares a section group calledmySectionGroup. -->
<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?
.

Nov 15 '05 #2
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
"Stefano Meier" <st*********@freesurf.ch> wrote in message
news:10***************@fuchs.cyberlink.ch...
I have tried the example on the following url but it has given me an error

http://msdn.microsoft.com/library/en...tiongroups.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?

Nov 15 '05 #3

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

Similar topics

13
by: Maxim Khesin | last post by:
I want to have a config file with my python proggie, satisfying the following requirements: 1) support key->(value, default) 2) simple and intuitive to read and edit 3) easyly readable into a...
4
by: Fuzzyman | last post by:
There have been a couple of config file 'systems' announced recently, that focus on building more powerful and complex configuration files. ConfigObj is a module to enable you to much more *simply*...
3
by: Richard Lewis Haggard | last post by:
I have a test application that is calling an assembly that reads some strings out of a config file. Normally, this assembly supports a web application and the information can be read just fine....
13
by: Khodr | last post by:
Hello, I am using VS.NET 2003 and vb. I build my application MyApp and it generates MyApp.exe.config. So now MyApp.exe reads parameters from MyApp.exe.config. Great and no problem! I need to...
20
by: tomerfiliba | last post by:
hey i've been seeing lots of config-file-readers for python. be it ConfigObj (http://www.voidspace.org.uk/python/configobj.html) or the like. seems like a trend to me. i came to this conclusion...
11
by: TARUN | last post by:
Hello All I need to ask about the configuration file in .NET, There are Two config File 1. Web Config 2. Machine config I understand the the usage of Web config , but not able to understand...
12
by: dbuchanan | last post by:
Hello, (Is this the proper newsgroup?) === Background === I am building a solution with two projects. One project is my data access layer which contains my DataSet as an xsd file. The XSD...
5
by: mmcd79 | last post by:
I built a VB.net application that makes use of a machine level DB connection string setting, and a user level starting location setting. The machine level setting and the default user based...
10
by: eagle | last post by:
I have a web.config in my application that contains the connection strings to all my datasources. I want to move these connection strings to another web config up the folder hierarchy so that all...
5
by: =?Utf-8?B?SmVycnkgQw==?= | last post by:
I have a app that uses several membership/role providers. I can list these Providers with the code: Dim rootWebConfig1 As Configuration rootWebConfig1 =...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.