views:

571

answers:

3

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?

+6  A: 

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 &

Fredrik Mörk
+3  A: 

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

For example, & should be written as &.

Ch00k
Your answer was swallowed by SO formatting :)
Thorarin
Corrected. +1 :-)
Cerebrus
+2  A: 

You might want to enforce encryption for the connection string and application setting in the web.config file.

Please refer to the article here : http://davidhayden.com/blog/dave/archive/2005/11/17/2572.aspx

and here :

http://aspnet.4guysfromrolla.com/articles/021506-1.aspx

hadi teo