Posted on: 8/28/2013 6:31:02 PM | Views : 353

I was wondering if anyone had any sample code or a page that deals directly with the GetSafeHtmlFragment for .NET 4.5 Web forms and how to implement/use it.  There is a lot of information that I've read about various versions and whatnot and none of it really makes any sense or is outdated due to some 4.2 upgrade that killed Santitization.

I am using the AntiXss with no issues, so I was confused why it was so difficult to use the Sanitization library as well:
System.Web.Security.AntiXss.AntiXssEncoder.HtmlEncode(data, True) I have a very specific set of data I am allowing.  Only allowing an <img> tag with a set of attributes (used for tracking pixels to be added).  Attributes include height, width, style, alt, and src.
...

Go to the complete details ...