Asp.net-Mvc-3

用剃刀顯示編碼的 html

  • February 17, 2011

我將編碼的 HTML 儲存在數據庫中。

我可以正確顯示它的唯一方法是:

<div class='content'>    
  @MvcHtmlString.Create(HttpUtility.HtmlDecode(Model.Content));
</div>

它很醜。有沒有更好的方法來做到這一點?

嘗試這個:

<div class='content'>    
  @Html.Raw(HttpUtility.HtmlDecode(Model.Content))
</div>

引用自:https://stackoverflow.com/questions/5029264