How do I output raw html when using RazorEngine (NOT from MVC)

前端 未结 6 1690
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-24 04:34

I am trying to generate emails with HTML content. this content has already gone through sanitation so I am not worried in that regard, however when I call:

         


        
6条回答
  •  遥遥无期
    2020-12-24 04:38

    RazorEngine, like MVC's Razor View Engine, will automatically encode values written to the template. To get around this, we've introduce an interface called IEncodedString, with the default implementations being HtmlEncodedString and RawString.

    To use the latter, simply make a call to the inbuilt Raw method of TemplateBase:

    @Raw(Model.EmailContent)
    

提交回复
热议问题