Reputation: 34149
I am using Ganss.Xss.HtmlSanitizer
to sanitize input html. By default the sanitizer silently remove invalid html. Instead, I would like to throw exception when input is invalid html.
using Ganss.Xss;
var sanitizer = new HtmlSanitizer();
var html = @"invalid html";
var sanitized = sanitizer.Sanitize(html, "https://www.example.com");
There are few event handlers but I am not sure what property to use that determines if the html is invalid
var htmlSanitizer = new HtmlSanitizer();
htmlSanitizer.PostProcessNode += (s, e) =>
{
//What determines here that node is invalid?
};
Upvotes: 0
Views: 1227