How can I add an ampersand for a value in a app config file value


I've got a C# program with values in a config file. What I want is to store ampersands for an url value like...

  <add key="myurl" value=""/>

But I get errors building my site. The ampersand is not allowed. I've tried various forms of escaping the ampersands to no avail. Anyone know of the correct form to do this? All suggestions are welcome.

12/17/2008 9:45:28 PM

Accepted Answer

Use "&amp;" instead of "&".

12/17/2008 9:46:33 PM

Have you tried this?

  <add key="myurl" value=";cid=&amp;sid="/>

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow