title: A potentially dangerous Request.QueryString value was detected from the client when sending html markup from jquery post call to asp.net page
body: <p>I m making an ajax call using jQuery to an ASP.NET page which acts as my ajax server page to save the data which i am sending to it in the query string. In the ASP.NET page when i am trying to read the querystring i am getting this error:</p>
  
  <pre><code>A potentially dangerous Request.QueryString value was detected from the client...
  </code></pre>
  
  <p>I have set the  <code>ValidateRequest="false"</code> in my page. Dont want to set it for all the pages. So did it in page level instead of config level:</p>
  
  <pre><code>  var content = "&lt;h3&gt;Sample header&lt;/h3&gt;&lt;p&gt;sample para&lt;/p&gt;"
    content = encodeURIComponent(content);
    var url = "../Lib/ajaxhandler.aspx?mode=savecontent&amp;page=home&amp;ltxt=" + content;
  
       $.post(url, function (data) { 
         //check return value and do something
     });
  </code></pre>
  
  <p>and in my asp.net page:</p>
  
  <pre><code> &lt;%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ajaxhandler.aspx.cs" ValidateRequest="false" Inherits="MyProject.Lib.ajaxhandler" %&gt;
  </code></pre>
  
  <p>But when i am sending plain text instead of the html markup, it works fine.</p>