简体   繁体   English

MVC 4 HTML部分呈现为编码的HTML字符串

[英]MVC 4 Html Partial Render as Encoded HTML string

How would I get this: 我将如何获得:

<code class="language-markup">@Html.Partial("components")</code>

To output the encoded version of the HTML markup? 要输出HTML标记的编码版本? I tried the httpUtility but it threw up a few errors. 我尝试了httpUtility,但抛出了一些错误。

I think just call the encode 我想只是叫编码

<code class="language-markup">
    @Html.Encode(Html.Partial("components"))
</code>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM