xml配置文件中的转义字符

https://stackoverflow.com/questions/14607920/the-character-breaks-passwords-that-are-stored-in-the-web-config

答案一

I suspect that you didn't encode the password properly in the web.config file. Remember that web.config is a XML file, so entities must be encoded.

Instead of

my&password 

try

my&password

You can use sites such as FreeFormatter.com to escape/unescape XML strings.

答案二

< = &lt;
> = &gt;
" = &quot;
' = &apos;
& = &amp;

方案三

XML Escape / Unescape

Escapes or unescapes an XML file removing traces of offending characters that could be wrongfully interpreted as markup.

The following characters are reserved in XML and must be replaced with their corresponding XML entities:

  • ' is replaced with &apos;
  • " is replaced with &quot;
  • & is replaced with &amp;
  • < is replaced with &lt;
  • > is replaced with &gt;
原文地址:https://www.cnblogs.com/chucklu/p/8192027.html