-1

I'm using ck editor for my form

ck editor send <p> tag and I receive

A potentially dangerous Request.Form value was detected from the client (title=<p>efrgth</p> error 

code in form:

<div class="form-group">
    @Html.LabelFor(model => model.title, htmlAttributes: new { @class = "control-label col-md-2" })
    <div class="col-md-10">
        <textarea id="content" name="title" class="ckeditor form-control" dir="rtl"></textarea>
        @Html.ValidationMessageFor(model => model.title, "", new { @class = "text-danger" })
    </div>
</div>
Dale K
  • 25,246
  • 15
  • 42
  • 71
  • Does this answer your question? [Allow User to input HTML in ASP.NET MVC - ValidateInput or AllowHtml](https://stackoverflow.com/questions/3621272/allow-user-to-input-html-in-asp-net-mvc-validateinput-or-allowhtml) – Tieson T. Jan 20 '20 at 23:14
  • Also, please take some time to review https://stackoverflow.com/editing-help#code - code fences are made using back-ticks, `, not the apostrophe. – Tieson T. Jan 20 '20 at 23:17
  • @TiesonT.hi i read this questins but i dont wat using allow html i want repair ck editor – mohammadrahimi Jan 20 '20 at 23:37
  • 1
    There's nothing wrong with CKEditor, you don't need to "fix" it. It's a HTML editor. So if you want to use it properly, you need to change things so that your server will accept the incoming HTML from it. Hence the suggestion to use the `[AllowHtml]` attribute in some of the newer answers in that link. – ADyson Jan 21 '20 at 00:19

1 Answers1

0

Add the following code to your Page tag (WebForms):

validateRequest="false"

for exmaple :

<%@ Page Language="C#" AutoEventWireup="true" ValidateRequest="false"
EnableEventValidation="true" CodeBehind="Test.aspx.cs" Inherits="Test" %>

In case of MVC use this code:

[ValidateInput(false)]
public class YourController : Controller
{

}