Tem 27 2009

How can I use ampersand in AppSettings value - app config file

Category: ASP.NETLatif @ 00:28


If you want to put an & (ampersand) character into the value attribute of a key in the appSettings part of the XML .config file(web.config, app.config etc.)

Let's say, you have param like following, (The error will occur if you use like this)


    <add key="MyUrl" value="http://localhost:8080/mysite/summarize?name=testPDF&format=pdf"  />


Solution : 


    <add key="MyUrl" value="http://localhost:8080/mysite/summarize?name=testPDF&amp;format=pdf"  />


use &amp; instead of &

Cause :

It is because of XML rules that the & character is the token for beginning of a reference. For more information http://www.w3schools.com/xml/xml_cdata.asp

 tot ziens...


Tags: ,


ballon anniversaire ballon anniversaire France says:

Hello Guru, what entice you to post an article. This article was extremely interesting, especially since I was searching for thoughts on this subject last Thursday.

trasloco milano trasloco milano United States says:

nice post. .thanks for sharing

watch movies online free watch movies online free United States says:

I like watching movies online, it is way cheaper than going to the theaters.