title: Show new lines from text area in ASP.NET MVC
body: <p>I'm currently creating an application using ASP.NET MVC. I got some user input inside a textarea and I want to show this text with &lt;br /&gt;s instead of newlines. In PHP there's a function called nl2br, that does exactly this. I searched the web for equivalents in ASP.NET/C#, but didn't find a solution that works for me.</p>
  
  <p>The fist one is this (doesn't do anything for me, comments are just printed without new lines):</p>
  
  <pre><code>&lt;%
      string comment = Html.Encode(Model.Comment);
      comment.Replace("\r\n", "&lt;br /&gt;\r\n");
  %&gt;
  &lt;%= comment %&gt;
  </code></pre>
  
  <p>The second one I found was this (Visual Studio tells me VbCrLf is not available in this context - I tried it in Views and Controllers):</p>
  
  <pre><code>&lt;%
      string comment = Html.Encode(Model.Comment);
      comment.Replace(VbCrLf, "&lt;br /&gt;");
  %&gt;
  &lt;%= comment %&gt;
  </code></pre>