Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use double quotes in app.config

Tags:

.net

I need to put double quotes in configuration property Property1

 <Seection Name Propety1="" .../> 
like image 835
Captain Comic Avatar asked Oct 20 '10 15:10

Captain Comic


2 Answers

I believe the proper way to encode quotes in XML is via &quot;

See this answer: How do I escape double quotes in attributes in an XML String in T-SQL?

The same would go for any other 'special' characters you wish to include as data. Essentially, you should use the same encoding you would use in HTML attributes.

like image 166
Andrew Barber Avatar answered Sep 21 '22 22:09

Andrew Barber


You could html encode the value when you add it to the configuration file. This should ensure any special character will be handled correctly in the xml and be returned as expected.

like image 40
Andy Rose Avatar answered Sep 23 '22 22:09

Andy Rose