title: A potentially dangerous Request.Form value was detected from the client
body: <p>I have this issue. I have tried everything. ValidateRequest="false".. and decoding and encoding html.. etc. etc..</p>
  
  <p>What I need is a popup box (so im using ModalPopupExtender) to present to a user where people can type in xml settings and click ok/cancel button to close the popup and save. </p>
  
  <p>However i keep on getting this error "A potentially dangerous Request.Form value was detected from the client".. </p>
  
  <p>Here is my test code below (quick example of my scenario and error)..</p>
  
  <pre><code>&lt;%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication1.WebForm1"
      ValidateRequest="false" %&gt;
  
  &lt;%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head runat="server"&gt;
      &lt;title&gt;&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;form id="form1" runat="server"&gt;
      &lt;asp:ScriptManager ID="ScriptManager1" runat="server"&gt;
      &lt;/asp:ScriptManager&gt;
      &lt;div&gt;
          &lt;asp:Panel ID="Popup" runat="server" Width="800px" Style="display: none;"&gt;
              &lt;asp:LinkButton ID="Display" runat="server" Style="display: none;" OnClick="Display_Click" /&gt;
              &lt;cc1:ModalPopupExtender ID="ModalPopupExtender" runat="server" TargetControlID="Display"
                  PopupControlID="Popup" DropShadow="false" Y="10" /&gt;
              &lt;div id="Item"&gt;
                  &lt;div class="Item"&gt;
                      &lt;table width="100%"&gt;
                          &lt;tr&gt;                                
                              &lt;td&gt;
                                  &lt;textarea id="txtAreaValue" cols="35" rows="6" style="resize: none;" runat="server" /&gt;
                              &lt;/td&gt;
                          &lt;/tr&gt;
                          &lt;tr&gt;                                
                              &lt;td&gt;
                                  &lt;asp:Button ID="btnOk" Text="Ok" SkinID="default" Width="50px" runat="server" /&gt;
                                  &lt;asp:Button ID="btnCancel" Text="Cancel" SkinID="default" Width="50px" OnClick="BtnCancel_Click"
                                      runat="server" /&gt;
                              &lt;/td&gt;
                          &lt;/tr&gt;
                      &lt;/table&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/asp:Panel&gt;
      &lt;/div&gt;
      &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Code Behind:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web;
  using System.Web.UI;
  using System.Web.UI.WebControls;
  
  namespace WebApplication1
  {
      public partial class WebForm1 : System.Web.UI.Page
      {
          protected void Page_Load(object sender, EventArgs e)
          {
              ModalPopupExtender.Show();
              string str = "&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;&lt;XmlConfig xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"&gt; &lt;XmlConfig Type=\"TEST\" DefiningXpath=\"/PERSON/NAME\"&gt;&lt;Index Name=\"Name\" XPath=\"/PERSON/NAME/VALUE\" Type=\"String\" /&gt;&lt;Index Name=\"Id\" XPath=\"/PERSON/NAME/ID\" Type=\"String\" /&gt; &lt;/XmlConfig&gt;&lt;/XmlConfig&gt;";
  
              txtAreaValue.InnerText = str;
          }
  
          protected void Display_Click(object sender, EventArgs e)
          {
              //Shows the Item detail Edit box
              ModalPopupExtender.Show();
          }
  
          protected void BtnCancel_Click(object sender, EventArgs e)
          {
              ModalPopupExtender.Hide();
          }
      }
  }
  </code></pre>
  
  <p>To run the code.. Add ref to AjaxControltoolkit.dll and then run and you will see the textarea being populated with xml. Click on the cancel button and this causes the error. Please can anyone help me?</p>