开发者

AntiXss and my desired results

开发者 https://www.devze.com 2023-01-04 20:42 出处:网络
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 wa

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号