将HTML数据发送到Controller ASP .NET MVC4

时间:2014-04-20 17:14:47

标签: jquery asp.net asp.net-mvc

我想将数据作为Html发送到控制器并保存在数据库中。我尝试以html格式发送数据,但我失败了。

这是代码

$("#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();
    });

单击“保存”按钮时,此错误显示

enter image description here

我该怎么做才能解决这个问题

2 个答案:

答案 0 :(得分:1)

在以下控制器的post方法中添加

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

答案 1 :(得分:0)

尝试添加&#34; requestValidationMode = 2.0&#34;在.config中:

<httpRuntime requestValidationMode="2.0"/>

有关详情:A potentially dangerous Request.Form value was detected from the client