Muhammad Usman
Muhammad Usman

Reputation: 1362

Send HTML data to Controller ASP .NET MVC4

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

Upvotes: 0

Views: 816

Answers (2)

Najib
Najib

Reputation: 520

In your post method of the following controller just add

<pre>
[HttpPost, ValidateInput(false)]
</pre>

Upvotes: 1

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

Upvotes: 0

Related Questions