title: HtmlEncode on Post for ASP.Net MVC 3 Html.TextAreaFor
body: <p>I have an ASP.Net MVC 3 page in which I have an Html.TextAreaFor control, see code below.  If I try to submit the page to the http post action with text in angle brackets like: <code>&lt;test&gt;</code>, I get a yellow error screen saying:</p>
  
  <blockquote>
    <p>A potentially dangerous Request.Form value was detected from the
    client (RequestText="").</p>
  </blockquote>
  
  <p>I don't understand why I am getting this because I found <a href="http://weblogs.asp.net/scottgu/archive/2010/04/06/new-lt-gt-syntax-for-html-encoding-output-in-asp-net-4-and-asp-net-mvc-2.aspx">an article by Scott Guthrie</a> that says the new <code>&lt;%: %&gt;</code> syntax in .Net 4, will automatically HtmlEncode the element.  Since I'm using the &lt;%: %> syntax for the Html.TextAreaFor control, I thought it would automatically take care of this and convert the angle brackets to the proper "&amp;lt"; and "&amp;gt" strings.</p>
  
  <pre><code>&lt;% using (Html.BeginForm())
     { %&gt;
      &lt;%: Html.ValidationSummary() %&gt;
      &lt;h2&gt;Enter a description of the support needed&lt;/h2&gt;
      &lt;%: Html.TextAreaFor( m =&gt; m.RequestText, 4, 90, null) %&gt;
      &lt;input type="submit" value="Submit" /&gt;
  &lt;% } %&gt;
  </code></pre>