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
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("’", "'");
Please see the answer on this question:
ValidateRequest="false" doesn't work in Asp.Net 4
This is a change in .net 4.0.
If you are running .NET 4.0, add this in your web.config (under system.web)
<httpRuntime requestValidationMode="2.0" />
I've had this before.
You need to also add to your web.config file.
If you put your page into debug mode and read the text with the error message it tells you what to add and where to add it. I cant remember 100% why the error occurs, I think it's something to do with page content on postback and the browser thinking there is harmfull code in there.
See also: A potentially dangerous Request.Form value was detected from the client
and
http://www.codeproject.com/Tips/297679/A-potentially-dangerous-Request-Form-value-was-det
for a more complete explanation and solution.