I need to add html tags in app.config file in C# console application. I tried
<p>
but it dint work for me. Any ideas?
web> tag and the <appSettings> tag. (See the structure of web. config file in ASP.net 3.5.) The <appSettings> tag specifies application-wide settings using the <add> tag.
First, add a reference to System.Web
to your project. Then, you can store your HTML by HTML encoding it. Simply call HttpUtility.UrlDecode()
on your value stored in the config file.
Your config file:
<appSettings>
<add key="HTML" value="<p>My paragraph</p>"/>
</appSettings>
Your code:
string html = HttpUtility.UrlDecode(ConfigurationManager.AppSettings["HTML"]);
Think you would actually want to
string html = HttpUtility.HtmlDecode(ConfigurationManager.AppSettings["HTML"]);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With