Sandboxed Plugin Development: HtmlDecode Tidbit

When working with things like Email, it is sometimes necessary to decode a string of text that has been HTML-encoded. This is the process where special characters are replaced with their numerical equivalents to prevent misinterpretation of the HTML text.

You use it like this:

string xmlPacket = HttpUtility.HtmlDecode(input);

This method is found inside of System.Web, which seems to require full trust to run properly.

Since I’m running in the sandbox, I can only use partial trust assemblies.

Thankfully, the System.Net assembly has: WebUtility.HtmlDecode, which works exactly the same AND doesn’t cause us security issues.

Leave a Reply 0 comments