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
How to Modify Existing Xml File with Xmldocument and Xmlnode in C#
How to Extend C# Built-In Types, Like String
Multi Threading C# Application with SQL Server Database Calls
How to Make a Combobox Non-Editable in .Net
How to Fix Wpf Error: "Program Does Not Contain a Static 'Main' Method Suitable for an Entry Point"
Record Video of Screen Using .Net Technologies
Html.Enumdropdownlistfor: Showing a Default Text
Is There a Serializable Generic Key/Value Pair Class in .Net
From Excel to Datatable in C# with Open Xml
String.Isnullorwhitespace in Linq Expression
Get Substring - Everything Before Certain Char
Where to Find "Microsoft.Visualstudio.Testtools.Unittesting" Missing Dll
Disable Application Insights in Debug