I need to save the escaped html string in a key in web.config using the KeyValueConfigurationElement.Save Method built into the 3.5 framework. But when I try to do this, he continues to run away from my ampersands.
The code is as follows:
strHTML = DecodeFTBInput(FTB1.Text)
FTB1.Text is an HTML string, for example: <b><font color="#000000">Testing</font></b>
DecodeFTPInput uses the String.Replace () method to change <and> to <and >, and "to ".
Given the above line and function, let's say it strHTMLnow contains the following:
<b><font color="
Of course, I can manually change web.config to save the correct value, but I need an authenticated admin user to be able to change the html itself.
The problem is that when I try to save this line in its key in web.config, it avoids all ampersands like &that which breaks the line.
How can I get around this?
source
share