So since System.Web
& HttpContext
isn't available in Silverlight is there a way to do HtmlDecode
& HtmlEncode
inside a Silverlight app without some horrendous Regex?
Asked
Active
Viewed 3,843 times
17

animuson
- 53,861
- 28
- 137
- 147

Glenn Slaven
- 33,720
- 26
- 113
- 165
1 Answers
27
System.Windows.Browser has an HttpUtility class with HtmlEncode and HtmlDecode methods.

Rex M
- 142,167
- 33
- 283
- 313
-
This method only replaces the characters <, >, & and ". Is there a better way to also replace line feeds and other speical characters? – helb Oct 08 '14 at 08:06
-
@helb what would you replace a line feed with? HtmlEncoding is to ensure that a text blob can be safely passed through an HTML parser without triggering any DOM parsing... need to understand better what your actual need is. I suggest opening a new question. – Rex M Oct 08 '14 at 13:20