title: ASP .NET Razor, producing truly raw output
body: <p>I'm using ASP .NET MVC 4 to produce a web application.</p>
  
  <p>I store code in various programming languages in a database, including C# which makes aggressive use of angular brackets (&lt;>). I use a javascript library to render this code literally on the screen. A bit of research reveals that @Html.Raw() is the method of choice for producing unencoded output, but practice shows that output produced this way isn't truly "Raw", and it seems that Razor will see these angular brackets in my code and try to "correct" the bad "HTML".</p>
  
  <p>The end result is not valid C-like code. Oops.</p>
  
  <p>Is there some way to bypass any kind of processing whatsoever from Razor and output the code in my query <em>directly</em> to the view?</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>Here's the example that was specifically annoying me:</p>
  
  <pre><code>using System;
  
  public class Greeter {
      public static void Main() {
          string name = "&lt;Your Name&gt;";
          Console.WriteLine("Hello, " + name + "! Welcome to C#.");
      }
  }
  </code></pre>
  
  <p>What instead gets printed to HTML output via Html.Raw() is:</p>
  
  <pre><code>using System;
  
  public class Greeter {
      public static void Main() {
          string name = "&lt;your name=""&gt;";
          Console.WriteLine("Hello, " + name + "! Welcome to C#.");
      }
  }
  &lt;/your&gt;
  </code></pre>
  
  <p><strong>Edit 2:</strong></p>
  
  <p>It should be acknowledged that the raw C# isn't valid HTML. The code is actually read in javascript and undergoes encoding specific to rendering code in HTML (using codemirror). This is why encoded HTML (which would actually undergo encoding twice) and "corrected HTML" (which makes gibberish C#) are both inadequate forms of output for my specific needs. This is why I'd like to output my data as-is.</p>
  
  <p><strong>Edit 3:</strong></p>
  
  <p>To clarify, my question is not anything related to how to render code in HTML. My question is, how can I achieve unadulterated control over the output of a unit of data in the raw underlying page source of a view using Razor or some other utility available via ASP .NET MVC? @Html.Raw() does not seem to achieve this desired outcome.</p>