title: ActionFilterAttribute - A potentially dangerous Request.Form value
body: <p>I have an auditing system in place that is failing when form values contain HTML.</p>
  
  <p>I have added the <code>[AllowHtml]</code> attribute to the model property in question, and have tried adding <code>[ValidateInput(false)]</code> to the controller action, as well as using the <code>Unvalidated()</code> extension method on <code>HttpRequestBase</code>.</p>
  
  <p>None of this is preventing the error.  The line of code it fails on (in the auditing code, <code>OnActionExecuting()</code> of the derived <code>ActionFilterAttribute</code>) is:</p>
  
  <pre><code>return Json.Encode(new { request.Cookies, request.Headers, request.Files, request.Form, request.QueryString, request.Params });
  </code></pre>
  
  <p>Error is:</p>
  
  <blockquote>
    <p>A first chance exception of type
    'System.Web.HttpRequestValidationException' occurred in System.Web.dll</p>
    
    <p>Additional information: A potentially dangerous Request.Form value was
    detected from the client (Note="<code>&lt;p&gt;test&lt;/p&gt;</code>").</p>
  </blockquote>
  
  <p>"Note" being the model property with <code>[AllowHtml]</code> on it.</p>
  
  <p>Any ideas on how I can prevent this?</p>