AntiXss and my desired results
After scrubbing my field with AntiXss.HtmlEncode is there a way to remove all the开发者_StackOverflow社区 html elements because they still show up as literals in the display?
No, there isn't. If you want to remove HTML elements and then HtmlEncode the result, you have to actually parse the code and remove the elements.
You can use the HTML Agility Pack or any other HTML parser to parse the content, get the InnerText of the root element (this will be only the text of the content) and then call AntiXss.HtmlEncode on that result.
精彩评论