AjaxControlToolkit.Sanitizer class disappeared ?

AjaxControlToolkit.Sanitizer class disappeared ?

So, you just updated your AjaxControlToolkit, and found out you don’t have anymore AjaxControlToolkit.Sanitizer class, right ? And there’s not even ONE single post on all the world talking about it, right ? Ok, you’ve come in the right place.

This is what happens when Microsoft starts behaving with *nux (il)logic, that is “fcb”: fuck backward compatibility !!! You wrote your code more than 2/3 years ago ? You’re old ! You should be banned ! Nothing should last so long !!!

The solution is…

  • Get back to Manage NUGet Packages for solution

  • Go to “browse” and search for sanitizer, select the new “AjaxControlToolkit.HtmlEditor.Sanitizer”, choose exactly the same version of the “AjaxControlToolkit” you should already have installed or updated (if not, install it too).

  • Replace your old reference, from, for example:
    AjaxControlToolkit.Sanitizer.HtmlAgilityPackSanitizerProvider mySanitizer = new AjaxControlToolkit.Sanitizer.HtmlAgilityPackSanitizerProvider();
    To the fucking new, changed/renamed, class:
    AjaxControlToolkit.HtmlEditor.Sanitizer.DefaultHtmlSanitizer mySanitizer = new AjaxControlToolkit.HtmlEditor.Sanitizer.DefaultHtmlSanitizer();

Now, you’ll find obviously that nobody took care of creating an overload of the old GetSafeHtmlFragment method, always because of the FCB (see above)… so, this line will throw an error:

return mySanitizer.GetSafeHtmlFragment(strMyHTMLText, myTagsWhiteList, myAttributeWhiteList);


The reason is: there’s no more AttributeWhiteList allowed to be specified !!!!!!!!! So you’ll need to stick to TagsWhitelist only.

Yes, you got it. None of their business. You can fuck yourself if you disagree. Who cares.


So, you have to stick to the new format:
return mySanitizer.GetSafeHtmlFragment(strMyHTMLText, myTagsWhiteList);

and throw away your old attributes list.

Then, checkout your web.config as suggested here:

https://github.com/DevExpress/AjaxControlToolkit/wiki/Upgrading-from-v7.x-and-below

Cheers !

Leave a Reply

Your email address will not be published. Required fields are marked *







*