码迷,mamicode.com
首页 > 其他好文 > 详细

KindEditor富文本编辑器, 从客户端中检测到有潜在危险的 Request.Form 值

时间:2015-04-15 10:59:15      阅读:123      评论:0      收藏:0      [点我收藏+]

标签:

在用富文本编辑器时经常会遇到的问题是asp.net报的”检测到有潜在危险的 Request.Form 值“一般的解法是在aspx页面   page  标签中加上 validaterequest=‘false‘  但这样的话   既不安全

  也不一定有效,好吧,说说我的解决方法吧, 就是在提交的时候不让富文本的内容提交,先是把内容编码给到一个隐藏标签,然后给富文本赋空值。

技术分享
 1           KindEditor.ready(function (K) {
 2                 Editor = K.create(‘#txtIntroduction‘, {
 3                     items: [
 4                         ‘bold‘, ‘italic‘, ‘underline‘, ‘|‘, ‘insertorderedlist‘, ‘insertunorderedlist‘, ‘|‘, ‘image‘, ‘|‘, ‘forecolor‘, ‘hilitecolor‘, ‘fontname‘, ‘fontsize‘, ‘|‘, ‘source‘
 5                     ],
 6                     uploadJson: ‘../../Scripts/kindeditor/uploadpic.aspx‘,
 7                     afterCreate: function () {
 8                         this.sync();
 9                     },
10                     afterBlur: function () {
11                         this.sync();
12                     },
13                     afterChange: function () {
14                         this.sync();
15                     }
16                 });
17             });
18         });
19 
20         function AddCheck() {
21     $("#hdIntroduction").val(escape(Editor.html()));
22             $(‘#txtIntroduction‘).val("");
23             Editor.html("");
24         }
25                 <asp:Button ID="btnsave" Text="保存设置" runat="server" OnClick="btnsave_Click" OnClientClick="return AddCheck();" />
View Code

 

 

  

KindEditor富文本编辑器, 从客户端中检测到有潜在危险的 Request.Form 值

标签:

原文地址:http://www.cnblogs.com/scien626/p/4427740.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!