0

In my app.config file I want to add param2="&password=" but it doesn't work because of "&" char any idea why ?

 <configSections>
        <sectionGroup name="API">
          <section name="loginURL" type="System.Configuration.SingleTagSectionHandler"/>
        </sectionGroup>
 </configSections>
 <API>
        <loginURL url="http://test.fr:81/api/sm?" param1="name=" param2="&password="/>
 </API>
MrB3NiT0
  • 137
  • 1
  • 15

1 Answers1

3

Since web.config files are XML, they follow normal XML rules. This means the attributes are XML encoded. To use an & sign, you should replace it with &amp;

 <configSections>
        <sectionGroup name="API">
          <section name="loginURL" type="System.Configuration.SingleTagSectionHandler"/>
        </sectionGroup>
 </configSections>
 <API>
        <loginURL url="http://test.fr:81/api/sm?" param1="name=" param2="&amp;password="/>
 </API>
DavidG
  • 104,599
  • 10
  • 205
  • 202