What is the meaning of A potentially dangerous Request.Form value was detected from the client error message

后端 未结 4 447
闹比i
闹比i 2021-01-23 17:41

I was trying to send an email via my web project using Free text box control.It is an text editor . but I\'ve got this error.

A potentially dangerous Request.For

4条回答
  •  失恋的感觉
    2021-01-23 18:01

    FreeTexBox control and "A potentially dangerous Request.Form value was detected from the client"

    You can try another decision

     if(!this.Page.ClientScript.IsOnSubmitStatementRegistered("Replace"))
    {
     string script = @"if (Page_IsValid){FTB_API['" + txtBox.ClientID + @"'].initialized=false;   FTB_API['"  + txtBox.ClientID + @"'].htmlEditor.value=FTB_FreeTextBox.prototype.HtmlEncode( FTB_API['" + txtBox.ClientID + @"'].htmlEditor.value);}";
     this.Page.ClientScript.RegisterOnSubmitStatement(this.Page.GetType(), "Replace", script);
    }
    

    and don't forget to replace symbols when you send string from server to the client application

    if(!String.IsNullOrEmpty(yourstring)) txtBox.Text= yourstring.Replace(">", ">").Replace("<", "<").Replace("&", "&").Replace(""", ('"').ToString()).Replace("’", "'");
    

提交回复
热议问题