locked
How to html encode user input with AutoCompleteExtender RRS feed

  • Question

  • User-359936451 posted

    I have a textbox with the AutoCompleteExtender which calls a web service. 

    I am looking for a way to encode user input in the textbox so that the dreadful

    *A potentially dangerous Request.Form value was detected from the client *

    I don't have any issues encoding other input, just can't figure out how to do this with the extender.

    Most of the time it was expected that the user would simply type character by character, but in some cases they paste in an html string that is legit for the database and the error pops. I need to allow the html, so custom error is not a viable solution.

                        <asp:TextBox ID="TextBox1" runat="server" Width="520px" Height="24px" 
                        AutoPostBack="True" Font-Names="Tahoma"></asp:TextBox>
                    <asp:AutoCompleteExtender 
                        ID="TextBox1_AutoCompleteExtender" 
                        runat="server" 
                        DelimiterCharacters="" 
                        Enabled="True" 
                        EnableCaching="True" 
                        ServiceMethod="GetCompListFuz" 
                        ServicePath="~/srch/strgSrch.asmx" 
                        TargetControlID="TextBox1" 
                        UseContextKey="True" 
                        CompletionSetCount="30" 
                        CompletionInterval="10"
                        MinimumPrefixLength="3"
                        CompletionListItemCssClass="itemHighlighted" 
                        CompletionListHighlightedItemCssClass="itemHighlighted2"                      
                        BehaviorID="AutoCompleteEx1"  
                        OnClientPopulated="acePopulated1"
                        OnClientItemSelected="aceSelected1">                    
                    </asp:AutoCompleteExtender>

    Is there some way to do this?

    Friday, April 22, 2016 3:07 PM

All replies