Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

Sanitizer in Ajax Control Toolkit truncates if the User gives a line break inside the textbox

$
0
0

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?


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>