0

I want to send data as Html to controller and save in database. I try to send data as html but I failed.

Here is code

$("#savechanges").click(function () {
        $("#notify").val($("#notify_to").val());

        //here I want to send html to controller
        $("#editor").val($("input[name='" + "Editor2" + "']").val());

        $("#nid").val($(".notifybox").attr('id'));
        $("#form_editing").submit();
    });

When I click save button then this error shows

enter image description here

What can I do to fix this problem

Muhammad Usman
  • 1,366
  • 5
  • 18
  • 33
  • Another potential solution : http://stackoverflow.com/questions/8808910/htmlencode-on-post-for-asp-net-mvc-3-html-textareafor Use the `[AllowHtml]` attribute. – Jason Evans Apr 20 '14 at 17:37

2 Answers2

1

In your post method of the following controller just add

<pre>
[HttpPost, ValidateInput(false)]
</pre>
Najib
  • 500
  • 2
  • 8
0

Try to add "requestValidationMode=2.0" in your .config:

<httpRuntime requestValidationMode="2.0"/>

For more details: A potentially dangerous Request.Form value was detected from the client

Community
  • 1
  • 1