The sanitizer truncates the whole text box value if the user gives a line break. And it passes empty string in to the table.
For example: if a user types Hello and press’s enter and again typesWorld this value would be passed as `“”` because user have inserted a line break ( <br> tag) in it. As the sanitizer is enabled it truncates the whole data in the textbox.
To reproduce this error :
Add the below two properties to the HtmlEditorExtender
1. EnableSanitization="true"
2. Enabled="true" (if you don’t enable it then it would also pass EmptyString)
<asp:HtmlEditorExtender ID="HtmlEditorExtender1" runat="server" EnableSanitization="true" Enabled="true" TargetControlID="txtBox1"><Toolbar><asp:Bold /><asp:Italic /><asp:Underline /><asp:BackgroundColorSelector /><asp:Subscript /><asp:Subscript /><asp:InsertOrderedList /><asp:InsertUnorderedList /><asp:ForeColorSelector /><asp:FontNameSelector /></Toolbar></asp:HtmlEditorExtender>
Add this to web config
<configuration><configSections><sectionGroup name="system.web"><section name="sanitizer" requirePermission="false" type="AjaxControlToolkit.Sanitizer.ProviderSanitizerSection, AjaxControlToolkit" /></sectionGroup></configSections><system.web><sanitizer defaultProvider="HtmlAgilityPackSanitizerProvider"><providers><add name="HtmlAgilityPackSanitizerProvider" type="AjaxControlToolkit.Sanitizer.HtmlAgilityPackSanitizerProvider"></add></providers></sanitizer></system.web></configuration>
So how we can overcome this?
Any ideas?