Use " instead of " to avoid it.
web.config is an XML file, so you should use XML escaping.
connectionString="Server=dbsrv;User ID=myDbUser;Password=somepass"word"
See this forum.
Update
" should work, but like not, have you tried some other string escape sequences for .NET? \" and "" ?
Update 2:
Try single quotes for connectionString:
connectionString='Server=dbsrv;User ID=myDbUser;Password=somepass"word'
Or:
connectionString='Server=dbsrv;User ID=myDbUser;Password=somepass"word'
Update 3:
From MSDN (SqlConnection.ConnectionString property):
To include values ββthat contain a semicolon, a single quote character, or a double quote character, the value must be enclosed in double quotation marks. If the value contains both a semicolon and a double quote character, the value can be enclosed in single quotes.
So:
connectionString="Server=dbsrv;User ID=myDbUser;Password='somepass"word'"
The problem is not in web.config, but in the connection string format. In the connection string, if you have " in value (key-value pairs), you need to enclose the value in ' . So, while Password=somepass"word does not work, Password='somepass"word' does.
Oded Jul 05 '10 at 7:53 on 2010-07-05 07:53
source share