public class DemoModel
    {
        public static string Content()
        {
            return "<p>aaaaaa</p>";
        }
    }

  

<h3>
    @MvcApplication1.Models.DemoModel.Content()
</h3>
<h3>@(new HtmlString(MvcApplication1.Models.DemoModel.Content()))</h3>
<h3>
    @Html.Raw(MvcApplication1.Models.DemoModel.Content())
</h3>
<h3>
    @MvcHtmlString.Create(MvcApplication1.Models.DemoModel.Content())
</h3>

  

MVC Razor 输出没有编码的HTML字符串

 

相关文章:

  • 2021-11-17
  • 2022-12-23
  • 2021-11-02
  • 2022-12-23
  • 2022-02-05
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-10-19
  • 2021-09-15
  • 2022-03-08
  • 2022-12-23
  • 2021-11-17
  • 2022-12-23
相关资源
相似解决方案