stackuser
stackuser

Reputation: 672

Web.config - multiple values for setting

Given below is the web.config file of an existing asp.net web service program (.asmx file)

The following code sets the value of TEST as EEE.

     <setting name="TEST" serializeAs="String">
       <value>EEEE</value>
      </setting> 

This is accccessed from the code using

TESTIntegrationWS.Properties.Settings.Default.TEST

How do I set multiple values for the the name "TEST" and access it from the code?

Web.config file

<?xml version="1.0" ?>
<configuration>
    <configSections>
        <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0,             Culture=neutral, PublicKeyToken=b77a5c561934e089">
            <section name="TESTIntegrationWS.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
            requirePermission="false" />
        </sectionGroup>
    </configSections>
    <applicationSettings>
        <TESTIntegrationWS.Properties.Settings>
            <setting name="TEST" serializeAs="String">
                <value>EEEE</value>
            </setting>
            <system.web>
                <compilation debug="true" targetFramework="4.0" />
            </system.web>
        </TESTIntegrationWS.Properties.Settings>
    </applicationSettings>
    <system.web>
        <compilation debug="true" />
    </system.web>
</configuration>

Upvotes: 1

Views: 738

Answers (1)

Adil
Adil

Reputation: 148180

If you want to assign multiple value to TEST then you can use some separator that is not expected in the value may be comma or semi-colon and in code you can use split to get array of values.

Upvotes: 1

Related Questions