20

What is the escape sequence for &-sign in string literals in web.config?

sly_Chandan
  • 3,437
  • 12
  • 54
  • 83
  • possible duplicate of [Where can I get a list of the XML document escape characters?](http://stackoverflow.com/questions/1091945/where-can-i-get-a-list-of-the-xml-document-escape-characters) – shahkalpesh Feb 02 '11 at 11:19
  • This answers does adress your issue: [escape-quote-in-web-config-connection-](http://stackoverflow.com/questions/3177861/escape-quote-in-web-config-connection-string#answer-10142361) – surfmuggle Mar 06 '14 at 11:57

3 Answers3

36

& -> &

here: What characters do I need to escape in XML documents?

Community
  • 1
  • 1
shahkalpesh
  • 33,172
  • 3
  • 63
  • 88
6

Use "&" instead of "&".

dogbane
  • 266,786
  • 75
  • 396
  • 414
0

I'm afraid the & doesn't work in web.config, it must have stricter rules than normal XML:

<add key="ST_CF_AppType_ipad" value="http://itunes.apple.com/se/app/itunes-u/id490217893?l=en&amp;mt=8" />

Gives an error occurred while parsing EntityName.

Joachim Sauer
  • 302,674
  • 57
  • 556
  • 614
SHO
  • 19
  • 1
    -1 because this is not correct. `` works fine in a Web.Config file. (Tested with the above appSetting in .NET 4.0 MVC app - but it should be the same in other framework versions.) – Jude Fisher Oct 02 '12 at 16:57