By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,225 Members | 2,170 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,225 IT Pros & Developers. It's quick & easy.

PLease help Application Configuration file access error ???

P: n/a
dear all,

I have problem accessing section group in my configuration
application file. I got an error saying thta I can have
only one section ????

here is my application configuration looks like:
================================================

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<!-- Definition of the application setting
Find here any parameters for the global application
startup phase
key : represent the name of the key to scan
value: represent the actual value of the found key --

<appSettings>
<add key="LogFile" value="TraceLog.txt" />
<add key="LogFilePath" value="C:\" />
</appSettings>

<!-- Definition of the tracing operation
bActivate : Set tracing to ON or OFF (1=ON, 0=OFF)
TraceSeverity : define what type of message level
should be trace based
on TraceLevel (none, info, warning,fatal, verbose =
0,1,2,3,4)
Note that a value of 3 will trace also level 1 and 2
-->
<system.diagnostics>
<switches>
<add name="Enabled" value="1" />
<add name="TraceSeverity" value="1" />
</switches>
</system.diagnostics>

<!-- Definition of the different setting belongng
to each assembly.
Assembly are identify by the group name and
parameter definition are identified by the
section name inside that group
-->
<configSections>
<!-- Definition of the User Management section -->
<sectionGroup name="UserManagement">
<section name="settings"

type="System.Configuration.NameValueSectionHandler " />
</sectionGroup>

<!-- Definition of the Configuration Mangement
section -->
<sectionGroup name="ConfigurationManagement">
<section name="settings"

type="System.Configuration.SingleTagSectionHandler " />
<section name="database"

</sectionGroup>

<!-- Definition of the Language Management section -->
<sectionGroup name="LanguageManagement">
<section name="settings"

type="System.Configuration.SingleTagSectionHandler " />
</sectionGroup>

<!-- Definition of the HMI builder Management
section -->
<sectionGroup name="HMIBuilder">
<section name="settings"

type="System.Configuration.SingleTagSectionHandler " />
</sectionGroup>

</configSections>
<!-- Definition of the User management assembly setting
Parameter define in this section are only used by
UserMangement -->
<UserManagement>
<settings>
<add key="UserName" value="calderara" />
<add key="PassWord" value="Tiphaine" />
<add key="RememberEntry" value="0" />
</settings>
</UserManagement>

<!-- Definition of the Configuration management assembly
setting
Parameter define in this section are only used by
UserMangement -->
<ConfigurationMangement>
<settings>
<add key="ConfigSaved" value="yes" />
<add key="AccessProviderDNS"
value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" />
</settings>

<database>
<add key="Path" value="E:\Configuration data
base" />
<add key="DNS"
value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" />
<add key="sqlserver" value="true" />
</database>
</ConfigurationMangement>

<!-- Definition of the Language management assembly setting
Parameter define in this section are only used by
UserMangement -->
<LanguageMangement>
<settings>
<add key="Default" value="English" />
</settings>
</LanguageMangement>

<!-- Definition of the HMI builder assembly setting
Parameter define in this section are only used by
UserMangement -->
<HMIBuilder>
<settings>
<add key="XPos" value="100" />
</settings>
</HMIBuilder>

</configuration>

Thnaks to help me how can I access my section group.
I have try to use the following to access them but no luck:

Dim nvc As NameValueCollection
nvc = CType(ConfigurationSettings.GetConfig
("UserManagement/settings"), NameValueCollection)

thanks agin for your help
regards

Jul 21 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
PROBLEM SOLVED
-----Original Message-----
dear all,

I have problem accessing section group in my configurationapplication file. I got an error saying thta I can have
only one section ????

here is my application configuration looks like:
=============================================== =

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<!-- Definition of the application setting
Find here any parameters for the global application
startup phase
key : represent the name of the key to scan
value: represent the actual value of the found key - -

<appSettings>
<add key="LogFile" value="TraceLog.txt" />
<add key="LogFilePath" value="C:\" />
</appSettings>

<!-- Definition of the tracing operation
bActivate : Set tracing to ON or OFF (1=ON, 0=OFF)
TraceSeverity : define what type of message level
should be trace based
on TraceLevel (none, info, warning,fatal, verbose =
0,1,2,3,4)
Note that a value of 3 will trace also level 1 and

2 -->
<system.diagnostics>
<switches>
<add name="Enabled" value="1" />
<add name="TraceSeverity" value="1" />
</switches>
</system.diagnostics>

<!-- Definition of the different setting belongng
to each assembly.
Assembly are identify by the group name and
parameter definition are identified by the
section name inside that group
-->
<configSections>
<!-- Definition of the User Management section -->
<sectionGroup name="UserManagement">
<section name="settings"

type="System.Configuration.NameValueSectionHandle r" />
</sectionGroup>

<!-- Definition of the Configuration Mangement
section -->
<sectionGroup name="ConfigurationManagement">
<section name="settings"

type="System.Configuration.SingleTagSectionHandle r" />
<section name="database"

</sectionGroup>

<!-- Definition of the Language Management section --

<sectionGroup name="LanguageManagement">
<section name="settings"

type="System.Configuration.SingleTagSectionHandle r" />
</sectionGroup>

<!-- Definition of the HMI builder Management
section -->
<sectionGroup name="HMIBuilder">
<section name="settings"

type="System.Configuration.SingleTagSectionHandle r" />
</sectionGroup>

</configSections>
<!-- Definition of the User management assembly setting
Parameter define in this section are only used by
UserMangement -->
<UserManagement>
<settings>
<add key="UserName" value="calderara" />
<add key="PassWord" value="Tiphaine" />
<add key="RememberEntry" value="0" />
</settings>
</UserManagement>

<!-- Definition of the Configuration management assembly
setting
Parameter define in this section are only used by
UserMangement -->
<ConfigurationMangement>
<settings>
<add key="ConfigSaved" value="yes" />
<add key="AccessProviderDNS"
value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" />
</settings>

<database>
<add key="Path" value="E:\Configuration data
base" />
<add key="DNS"
value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" />
<add key="sqlserver" value="true" />
</database>
</ConfigurationMangement>

<!-- Definition of the Language management assembly setting Parameter define in this section are only used by
UserMangement -->
<LanguageMangement>
<settings>
<add key="Default" value="English" />
</settings>
</LanguageMangement>

<!-- Definition of the HMI builder assembly setting
Parameter define in this section are only used by
UserMangement -->
<HMIBuilder>
<settings>
<add key="XPos" value="100" />
</settings>
</HMIBuilder>

</configuration>

Thnaks to help me how can I access my section group.
I have try to use the following to access them but no luck:
Dim nvc As NameValueCollection
nvc = CType(ConfigurationSettings.GetConfig
("UserManagement/settings"), NameValueCollection)

thanks agin for your help
regards

.

Jul 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.