CKEditor 和 asp.net

发布于 2024-10-09 05:22:58 字数 366 浏览 0 评论 0原文

我在我的页面上使用 CKEditor。除了我回发时之外,它工作正常。我收到此错误:

从客户端检测到潜在危险的 Request.Form 值 (ctl00$MainContent$txtDesc="

 

我使用此代码将 CKEditor 值放入提交按钮的 OnClientClick 事件的文本框中:

function getEditorValue(){
    var editor=$("#<%= txtDesc.ClientID%>").ckeditorGet();
    editor.updateElement();
    return true;
}

I am using CKEditor on my page. It is working fine except when I post back. I am getting this error:

A potentially dangerous Request.Form value was detected from the client (ctl00$MainContent$txtDesc="<p>
 </p>

I am using this code to put CKEditor value into textbox on OnClientClick event of submit button:

function getEditorValue(){
    var editor=$("#<%= txtDesc.ClientID%>").ckeditorGet();
    editor.updateElement();
    return true;
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

挽袖吟 2024-10-16 05:22:58

您是否尝试过设置 htmlEncodeOutput 属性?

> CKEDITOR.replace('#<%= txtDesc.ClientID%>', {
>  htmlEncodeOutput: true });

这应该对输出进行编码,并且您应该能够避免设置 requestValidationMode。

它的文档位于:ckEditor 文档

Have you tried setting the htmlEncodeOutput property?

> CKEDITOR.replace('#<%= txtDesc.ClientID%>', {
>  htmlEncodeOutput: true });

This should encode the output and you should be able to avoid setting the requestValidationMode.

Documentation for it is here: ckEditor documentation

人生百味 2024-10-16 05:22:58

<% @Page 声明中设置 ValidateRequest="False"

Set ValidateRequest="False" in your <% @Page declaration.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文