xml配置文件中的转义字符 escape character in xml file
答案一
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.
答案二
< = <
> = >
" = "
' = '
& = &
方案三
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 '
- " is replaced with "
- & is replaced with &
- < is replaced with <
- > is replaced with >