mqpasta
mqpasta

Reputation: 960

Special Characters in web.config file

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?

Upvotes: 17

Views: 30020

Answers (2)

David Wengier
David Wengier

Reputation: 10179

The web.config is like any other XML file, so certain characters need to be encoded.

For example, & should be written as &.

Upvotes: 8

Fredrik Mörk
Fredrik Mörk

Reputation: 158309

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 &

Upvotes: 38

Related Questions