I've looked for the answer and can't find it. It's got to be something obvious and I'm just missing it.
We have a connection string issue in an app.config file. It uses SQL Server authentication, and the password contains an "&" and a "+" symbol. Obviously the parsing is going wrong. Changing the password would be a hassle at this point. Is there a way to handle this?

Encode the '&' as '&' - ampersand is a reserved character in XML
More info: http://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references
Since the web.config is XML, you need to escape the five special characters:
& -> & ampersand, U+0026< --> < left angle bracket, less-than sign, U+003C> --> > right angle bracket, greater-than sign, U+003E"-> " quotation mark, U+0022'-> ' apostrophe, U+0027
+ is not a problem, I suppose.
web.config is an XML file and XML content needs to be escaped...
Change the & to & in the password field and you are good to do.
Try encoding the characters. Use & for ampersand.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With