PLease help Application Configuration file access error ???

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • serge calderara

    #1

    PLease help Application Configuration file access error ???

    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" ?>
    <configuratio n>
    <!-- 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 --[color=blue]
    >[/color]
    <appSettings>
    <add key="LogFile" value="TraceLog .txt" />
    <add key="LogFilePat h" 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.diagnos tics>
    <switches>
    <add name="Enabled" value="1" />
    <add name="TraceSeve rity" value="1" />
    </switches>
    </system.diagnost ics>

    <!-- 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="UserManag ement">
    <section name="settings"

    type="System.Co nfiguration.Nam eValueSectionHa ndler" />
    </sectionGroup>

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

    type="System.Co nfiguration.Sin gleTagSectionHa ndler" />
    <section name="database"

    </sectionGroup>

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

    type="System.Co nfiguration.Sin gleTagSectionHa ndler" />
    </sectionGroup>

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

    type="System.Co nfiguration.Sin gleTagSectionHa ndler" />
    </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="calderar a" />
    <add key="PassWord" value="Tiphaine " />
    <add key="RememberEn try" value="0" />
    </settings>
    </UserManagement>

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

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

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

    <!-- 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 NameValueCollec tion
    nvc = CType(Configura tionSettings.Ge tConfig
    ("UserManagemen t/settings"), NameValueCollec tion)

    thanks agin for your help
    regards

  • serge calderara

    #2
    PLease help Application Configuration file access error ???

    PROBLEM SOLVED
    [color=blue]
    >-----Original Message-----
    >dear all,
    >
    >I have problem accessing section group in my[/color]
    configuration[color=blue]
    >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 -[/color]
    -[color=blue][color=green]
    >>[/color]
    > <appSettings>
    > <add key="LogFile" value="TraceLog .txt" />
    > <add key="LogFilePat h" 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[/color]
    2[color=blue]
    > -->
    > <system.diagnos tics>
    > <switches>
    > <add name="Enabled" value="1" />
    > <add name="TraceSeve rity" value="1" />
    > </switches>
    > </system.diagnost ics>
    >
    > <!-- 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="UserManag ement">
    > <section name="settings"
    >
    >type="System.C onfiguration.Na meValueSectionH andler" />
    > </sectionGroup>
    >
    > <!-- Definition of the Configuration Mangement
    >section -->
    > <sectionGroup name="Configura tionManagement" >
    > <section name="settings"
    >
    >type="System.C onfiguration.Si ngleTagSectionH andler" />
    > <section name="database"
    >
    > </sectionGroup>
    >
    > <!-- Definition of the Language Management section --
    >
    > <sectionGroup name="LanguageM anagement">
    > <section name="settings"
    >
    >type="System.C onfiguration.Si ngleTagSectionH andler" />
    > </sectionGroup>
    >
    > <!-- Definition of the HMI builder Management
    >section -->
    > <sectionGroup name="HMIBuilde r">
    > <section name="settings"
    >
    >type="System.C onfiguration.Si ngleTagSectionH andler" />
    > </sectionGroup>
    >
    > </configSections>
    >
    >
    ><!-- Definition of the User management assembly setting
    > Parameter define in this section are only used by
    >UserMangemen t -->
    > <UserManagement >
    > <settings>
    > <add key="UserName" value="calderar a" />
    > <add key="PassWord" value="Tiphaine " />
    > <add key="RememberEn try" value="0" />
    > </settings>
    > </UserManagement>
    >
    ><!-- Definition of the Configuration management assembly
    >setting
    > Parameter define in this section are only used by
    >UserMangemen t -->
    > <ConfigurationM angement>
    > <settings>
    > <add key="ConfigSave d" value="yes" />
    > <add key="AccessProv iderDNS"
    >value="Provide r=Microsoft.Jet .OLEDB.4.0;Data Source=" />
    > </settings>
    >
    > <database>
    > <add key="Path" value="E:\Confi guration data
    >base" />
    > <add key="DNS"
    >value="Provide r=Microsoft.Jet .OLEDB.4.0;Data Source=" />
    > <add key="sqlserver" value="true" />
    > </database>
    > </ConfigurationMa ngement>
    >
    ><!-- Definition of the Language management assembly[/color]
    setting[color=blue]
    > Parameter define in this section are only used by
    >UserMangemen t -->
    > <LanguageMangem ent>
    > <settings>
    > <add key="Default" value="English" />
    > </settings>
    > </LanguageMangeme nt>
    >
    ><!-- Definition of the HMI builder assembly setting
    > Parameter define in this section are only used by
    >UserMangemen t -->
    > <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[/color]
    luck:[color=blue]
    >
    >Dim nvc As NameValueCollec tion
    > nvc = CType(Configura tionSettings.Ge tConfig
    >("UserManageme nt/settings"), NameValueCollec tion)
    >
    >thanks agin for your help
    >regards
    >
    >.
    >[/color]

    Comment

    Working...