Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the equivalent of @Html.Raw in Postal?

Tags:

c#

postal

I'm running Postal from a service. My @Message has html. @Html.Raw is not available. When Postal runs my templated view, I get HtmlEncoded html. does anyone know how to fix this?

like image 840
CurlyFro Avatar asked Sep 16 '15 18:09

CurlyFro


2 Answers

In our service, we've used:

@Raw(StringToBeEncoded)

In the html template it will complain it can not be resolved, but at runtime @Raw works fine. Its part of RazorEngine.

like image 163
MattWazEre Avatar answered Nov 05 '22 01:11

MattWazEre


You can use:

@(new System.Web.HtmlString(StringToBeEncoded))

which is basically the same as does HtmlHelper.Raw(StringToBeEncoded) method under the hood. Moreover, you will not get any error in Visual Studio for the templates.

like image 34
Jozef Benikovský Avatar answered Nov 05 '22 02:11

Jozef Benikovský