How to Add an Ampersand for a Value in a ASP.NET/C# App Config File Value

How can I add an ampersand for a value in a ASP.net/C# app config file value

Use "&" instead of "&".

Is it possible to have an ampersand sign in an appSettings key? error: web.config value is not defined

You just need to use XML encoding here I believe - so & becomes &

using & in appSettings in web.config

The problem was that I was using a web.config file when I should have been using an app.config file in my test project

How to write a password which contain & in app.config

Use & instead of &.

The & character breaks passwords that are stored in the web.config

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.

Escape & in App.config

Escape the ampersand by using & in place of the &

As an FYI, see here for further characters:
What characters do I need to escape in XML documents?



Related Topics



Leave a reply



Submit