现在的位置: 首页 > 综合 > 正文

FreeTextBox3.1.6中如何解决“检测到有潜在危险的 Request.Form 值”错误提示

2013年06月17日 ⁄ 综合 ⁄ 共 1087字 ⁄ 字号 评论关闭
在用FreeTextBox3.1.6的时候,如果我们将其Text值postback回去的时候,会出现上面标题所说的那个问题
下面就说说我的解决办法。
方法一:
1、打开FTB的客户端文件aspnet_client/FreeTextBox/FTB-FreeTextBox.js。
2、找到方法FTB_FreeTextBox.prototype.CopyDesignToHtml = function(){...};
3、将语句
 this.htmlEditor.value = html;
   改为
 this.htmlEditor.value = this.HtmlEncode(html);
4、每次将在 Page_Load(object sender,eventArgs e) 方法中。将 FreeTextBox1.Text的值改为
 
 this.FreeTextBox1.Text = HttpUtility.HtmlDecode(this.FreeTextBox1.Text);
---------------
注 :为什么一定要第4步? 因为我们客户端将其值给HtmlEncode啦,所以要还原它原始的html页面效果。
---------------
方法二:
 把包含FTB的page 中的 ValidateRequest 置 "false"。
方法三:
前三步和方法类似,第四步改为反编译FTB代码,

[Description("Contains the HTML for the editor."), Category("Output")]
public string Text
{
    get
    {
 object obj1 = this.ViewState["Text"];
 return ((obj1 == null) ? "" :  (string)obj1);
    }
    set
    {
 this.ViewState["Text"] = value;
    }
}

改为
 [Description("Contains the HTML for the editor."), Category("Output")]
public string Text
{
    get
    {
 object obj1 = this.ViewState["Text"];
 return ((obj1 == null) ? "" :  HttpUtility.HtmlDecode((string) obj1));
    }
    set
    {
 this.ViewState["Text"] = value;
    }
}

 http://www.cnblogs.com/3zfp/archive/2007/01/20/625695.html

抱歉!评论已关闭.