Special Characters in web.config file

asp.netconfiguration

My password contains special characters like '&' and VS giving error on this like Password=abcdef!@hh&held

How can I use special characters in my web.config file?

Best Answer

Since the web.config file is an XML file, the values need to be XML encoded:

Password=abcdef!@hh&held

Note how & is replaced by &