KindEditor富文本編輯器, 從客戶端中檢測到有潛在危險的 Request.Form 值


在用富文本編輯器時經常會遇到的問題是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

 

 

  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM