I have a form with a text box (tinymce) for input content. When I execute an ajax request, I got an error:
Potentially dangerous Request.Form value was detected by the client
Then I tried something like
html.encodeURIComponent()or escape(), but the error is still here
HTML:
<form id="editForm" action="" method="post">
<input type="text" id="title" name="title" />
<textarea id="content" name="content"></textarea>
<input type="button" id="submit" onclick="Submit();" />
</form>
Script (I use jQuery)
function Submit(){
$.ajax({
url: 'ajax.aspx?type=addcontent&' + $('#editForm').serialize() + '&rnd=' + Math.random(),
success: function(data) {
alert('OK');
}
});
}
As soon as I press the submit button, an error will appear. The ajax request is not executed. I tried adding ValidateRequest="false"to the aspx page, but the problem is still here.
Any help is appreciated!
source
share