Escape & in App.config
.NetApp Config.Net Problem Overview
I have the following piece of config in my App.config file:
<add key="ConnectionString"
value="INITIAL CATALOG=myDatabase;DATA SOURCE=myServer;User ID=myUser;Password=!&myPass99;"/>
The above connection string is rejected by Visual Studio intellisense. It says entity myPass99
not defined. The problem is caused by the & in the password.
How do I escape it?
.Net Solutions
Solution 1 - .Net
Escape the ampersand by using &
in place of the &
As an FYI, see here for further characters: https://stackoverflow.com/questions/1091945/where-can-i-get-a-list-of-the-xml-document-escape-characters