A potentially dangerous Request.Form value was detected from the client (
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/81991/a-potentially-dangerous-request-form-value-was-detected-from-the-client">A potentially dangerous Request.Form value was detected from the client</a>  </p>
</blockquote>



<p>I got error messages:<br></p>

<pre><code> A potentially dangerous Request.Form value was detected from the client 
 (ctl00$MainContent$textboxError=...
</code></pre>

<p><br>after I run asp.net (C#) web application. how can I fix it?  </p>

<p>Here is my code.</p>

<pre><code>using System;
using System.Data;
using System.Configuration;
using System.Web; 
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Net;
using System.Text.RegularExpressions;

namespace SMS
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
    textboxRecipient.Width = 400;
    textboxMessage.Width = 450;
    textboxMessage.Rows = 10;
    textboxError.Width = 400;
    textboxError.Rows = 5;

    textboxError.ForeColor = System.Drawing.Color.Red;
    textboxError.Visible = false;
    textboxError.Text = "";

    if (!Page.IsPostBack)
    {
        textboxRecipient.Text = "+85593840396";
        textboxMessage.Text = "Hello World!";
    }
}
protected void buttonSendOnClick(object sender, EventArgs e)
{

    if (textboxRecipient.Text == "")
    {
        textboxError.Text += "Recipient(s) field must not be empty!\n";
        textboxError.Visible = true;
        return;
    }


    string ozSURL = "http://127.0.0.1"; //where Ozeki NG SMS Gateway is running
    string ozSPort = "9501"; //port number where Ozeki NG SMS Gateway is listening
    string ozUser = HttpUtility.UrlEncode("tenh"); //username for successful login
    string ozPassw = HttpUtility.UrlEncode("tenh123"); //user's password
    string ozMessageType = "SMS:TEXT"; //type of message
    string ozRecipients = HttpUtility.UrlEncode(textboxRecipient.Text); 
    string ozMessageData = HttpUtility.UrlEncode(textboxMessage.Text); 

    string createdURL = ozSURL + ":" + ozSPort + "/httpapi" +
        "?action=sendMessage" +
        "&amp;username=" + ozUser +
        "&amp;password=" + ozPassw +
        "&amp;messageType=" + ozMessageType +
        "&amp;recipient=" + ozRecipients +
        "&amp;messageData=" + ozMessageData;

    try
    {

        HttpWebRequest myReq = (HttpWebRequest)WebRequest.Create(createdURL);


        HttpWebResponse myResp = (HttpWebResponse)myReq.GetResponse();
        System.IO.StreamReader respStreamReader=new 

      System.IO.StreamReader(myResp.GetResponseStream());
        string responseString = respStreamReader.ReadToEnd();
        respStreamReader.Close();
        myResp.Close();

        //inform the user
        textboxError.Text = responseString;
        textboxError.Visible = true;
    }
    catch (Exception)
    {

        textboxError.Text = "Ozeki NG SMS Gateway Server is not running!";
        textboxError.Visible = true;
    }

  }
  }
  }
</code></pre>

<p>I already add codes below to my web.config :</p>

<pre><code>   validateRequest="false" and requestValidationMode="2.0"
</code></pre>
