0

私はCLEditorを使用してアプリユーザーにhtmlエディターを提供しています.CLEditorはテキスト領域を使用して生成されたhtmlを維持しています.jquery ajaxを使用してhtmlを保存しています:

$(".btnSave").click(function () {
    var description = $(this).find("textarea[name='Description']").val();
    $.ajax({
            url: "/Product/SaveDescription",
            data: { description: description },
            success: function (result) {
                alert("Saved successfully.");
            },
            error: function (xhr, state, msg) {
                alert(msg);
            }
    });
});

しかし、変数 (説明) に html タグが含まれていると、アクションがトリガーされず、エラー (内部サーバー エラー) が発生します。

これは私のアクションメソッドです:

public void SaveDescription(string description)
{
     //save the description
}   

ご覧のとおり、HTML を許可するために AllowHtml 属性が必要な MVC モデル バインダーを使用していないので、何が問題なのですか?

ご協力いただきありがとうございます。

4

1 に答える 1