dimanche 3 mai 2015

How to prevent: A potentially dangerous Request.Form value was detected from the client

asp.net C# 4.5 application

page level validation disable not working since 4+ event validation is targeted

So i need to encode textbox content before submitting the form

However my try failed

   function encodeTextBox() {
           <%
    txtNewsBody.Text = System.Web.HttpUtility.HtmlEncode(txtNewsBody.Text);
         %>
       }


          <asp:Button ID="btnAddNews" OnClientClick="encodeTextBox(); return true;" runat="server" Text="add_news" OnClick="btnAddNews_Click" />

Aucun commentaire:

Enregistrer un commentaire