我需要在C#控制台应用程序的app.config文件中添加HTML标签。我尝试过:
但对我来说没有用。有什么想法吗?
<p>
但对我来说没有用。有什么想法吗?
<p>
System.Web
添加到您的项目引用中。然后,您可以通过HTML编码来存储您的HTML。只需在配置文件中调用HttpUtility.UrlDecode()
即可。<appSettings>
<add key="HTML" value="<p>My paragraph</p>"/>
</appSettings>
string html = HttpUtility.UrlDecode(ConfigurationManager.AppSettings["HTML"]);
你真的想要这样做吗?
string html = HttpUtility.HtmlDecode(ConfigurationManager.AppSettings["HTML"]);