How to save a string with html content in application settings

I wrote an email code and I need to send all emails with a signature.

I was asked to save the signature in the settings of the web.config file.

I am not sure if this is the right place. Can anyone advise me otherwise? As far as I know, there will be only one electronic signature.

I tried:

<appSettings> <add key="CompanyEmailSignature" value="The Biscuit Factory\n\r Somewhere in the Bahamas\n\r <a href="http://www.thebiscuitfactory.com">The Biscuit Factory</a>\n\r Our mission is to make tasty biscuits" /> </appSettings> 

I'm not sure how to run for the link. I took a look at some suggestions and tried:

 <a href=""http://www.thebiscuitfactory.com"">The Biscuit Factory</a> 

and I tried:

 <a href=\"http://www.thebiscuitfactory.com\">The Biscuit Factory</a> 

but could not get it to work.

Can someone tell me how to avoid this, and if there is somewhere else, is it better to keep it?

+4
source share
1 answer

You have already tried changing < and > to &lt; and &gt; ?

< and > not allowed inside the xml attribute (appsettings).

Also for " you can try using &quot;

So, in the end you have this:

 <appSettings> <add key="CompanyEmailSignature" value=" The Biscuit Factory\n\r Somewhere in the Bahamas\n\r &lt;a href=&quot;http://www.thebiscuitfactory.com&quot;&gt;The Biscuit Factory&lt;/a&gt;\n\r Our mission is to make tasty biscuits " /> </appSettings> 
+8
source

Source: https://habr.com/ru/post/1479828/


All Articles