title: Render razor view to string without munging the html
body: <p>I've previously found answers on how to render an MVC 4 view to a string. However, I started using <strong>Visual Studio 2013</strong> and now the result is not as expected. See below.</p>
  
  <pre><code> &lt;$A$&gt;&lt;$B$&gt; &lt;$C$&gt; class="panel"&lt;$D$&gt;&gt; &lt;$E$&gt; class="cover-wrapper"&lt;$F$&gt;&gt; &lt;$G$&gt; href="     
   &lt;$H$&gt;/book/&lt;$I$&gt;&lt;$J$&gt;1&lt;$K$&gt;&lt;$L$&gt;/&lt;$M$&gt;"&lt;$N$&gt;&gt;&lt;$O$&gt; src="&lt;$P$&gt;http://www.
   example.com/images/image.jpg&lt;$Q$&gt;"&lt;$R$&gt; class="cover"&lt;$S$&gt; /&gt; &lt;$T$&gt; href="&lt;$U$&gt;
   &lt;$V$&gt;"&lt;$W$&gt; target="_blank"&lt;$X$&gt; rel="nofollow"&lt;$Y$&gt; class="amazon-button"&lt;$Z$&gt;&gt; &lt;$a$&gt; 
   class="amazon-cart"&lt;$b$&gt;&gt; Link → 
   &lt;$c$&gt; class="content"&lt;$d$&gt;&gt;..........
  </code></pre>
  
  <p>The code being used is this:</p>
  
  <pre><code>    public string RenderRazorViewToString(string viewName, object model)
      {
          ViewData.Model = model;
          using (var sw = new StringWriter())
          {
              var viewResult = ViewEngines.Engines.FindPartialView(ControllerContext, viewName);
              var viewContext = new ViewContext(ControllerContext, viewResult.View, ViewData, TempData, sw);
              viewResult.View.Render(viewContext, sw);
              viewResult.ViewEngine.ReleaseView(ControllerContext, viewResult.View);
              return sw.GetStringBuilder().ToString();
          }
      }
  </code></pre>
  
  <p>Any idea as to why all the letters and dollar signs are showing up now or how I need to change my code to get it to give me usable html?</p>