title: MVC ASP.NET MVC3 AllowHtml Attribute Not Working?
body: <p>The question is very simple:</p>
  
  <p>Say you have a model called Person</p>
  
  <pre><code>public class Person
  {
  
         public int PersonID {get; set;}
  
         public string Name {get; set;}
  
         [AllowHtml] // Allow html in Intro property
         public string Intro {get; set;}
  
         [ScaffoldColumn(false)]
         public string ComplicatedValue {get; set;}
  
  }
  </code></pre>
  
  <p>In controller's Create action</p>
  
  <pre><code>[HttpPost]
  public ActionResult Create(Person o, FormCollection collection)
  {
  
  // whatever code here;
  
  }
  </code></pre>
  
  <p>If you run it,</p>
  
  <ol>
  <li>input plain text for Intro, no
  problem happens. </li>
  <li>input html content for Intro, no matter how you set
  your configuration file, it will
  tells "A potential dangerous ..."</li>
  </ol>
  
  <p><strong>I DO find the reason of this problem.</strong></p>
  
  <p>If you change the function to</p>
  
  <pre><code>public ActionResult Create(Person o) // Get rid of the *FormCollection collection*
  {
  
  // whatever code here;
  
  }
  </code></pre>
  
  <p>This will eliminate the "potential dangerous" error.</p>
  
  <p><strong>But my problem</strong> is that for my application, I have to use the secondary parameter <strong>FormCollection collection</strong> in the Create Action method, because I need to use some other control values and server variable to assign a calculated value to the <strong>ComplicatedValue</strong> property.</p>
  
  <p>If any expert of ASP.NET MVC3 have met the same problem as me, and found a solution, please kindly let me know. </p>