Error when using text editor to pass style text to the database

Source: Internet
Author: User

First download a HTML5 editor KINDEDITOR-4.1.10-ZH-CN

Put the following files of the folder in the kindeditor-4.1.10-zh-cn Editor in your own project

Then in the path: kindeditor-4.1.10-zh-cn\kindeditor-4.1.10\jsp folder find demo.jsp with Notepad open reference inside the following:
<!doctype html>
<meta charset= "Utf-8"/>
<title>kindeditor jsp</title>
<link rel= "stylesheet" href= ". /themes/default/default.css "/>
<link rel= "stylesheet" href= ". /plugins/code/prettify.css "/>
<script charset= "Utf-8" src= ". /kindeditor.js "></script>
<script charset= "Utf-8" src= ". /lang/zh_cn.js "></script>
<script charset= "Utf-8" src= ". /plugins/code/prettify.js "></script>
<script>
Kindeditor.ready (function (K) {
var editor1 = k.create (' textarea[name= "content1"] ', {
Csspath: '. /plugins/code/prettify.css ',
Uploadjson: '. /jsp/upload_json.jsp ',
Filemanagerjson: '. /jsp/file_manager_json.jsp ',
Allowfilemanager:true,
Aftercreate:function () {
var = this;
K.ctrl (document, function () {
Self.sync ();
Document.forms[' Example '].submit ();
});
K.ctrl (Self.edit.doc, +, function () {
Self.sync ();
Document.forms[' Example '].submit ();
});
}
});
Prettyprint ();
});
</script>

and add it in the. aspx content page

<textarea name= "Content1" cols= "rows=" 8 "style=" width:793px;height:200px " ></textarea>
<asp:button id= "Btnok" runat= "Server" text= "Publish" height= "29px" width= "84px"
onclick= "Btnok_click"/>

The execution page will show that the editor appears in the page

But after you type in the text and give it a style and convert the text to HTML in the upper-left corner of the editor

Click Publish the following error occurs when you want to save him to the database:

Q:

Potentially dangerous request.form values were detected from the client (content= <p> test </p>).
I have tried to validaterequest=false, but still do not, just contact ASP. NET MVC development model, various is not very clear &lt;%html.beginform ("Submitaddnews", "News",   FormMethod.Post, new {id = "form"});%&gt; This is the way to submit the hero to give guidance

Solution:

Add

That's OK.

Error when using text editor to pass style text to the database

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.