RazorEngine issues with @Html

Check https://github.com/Antaris/RazorEngine/wiki/6.-Encoding-Values page. I copy / past it here:

By default, RazorEngine is configured to encode as HTML. This sometimes presents problems where certain characters are encoded as HTML when you wanted the output to be as-is.

To output something in raw format, use the @Raw() built-in method as shown in the following example:

string template = "@Raw(Model.Data)";
var model = new { Data = "My raw double quotes appears here \"hello!\"" };

string result = Razor.Parse(template, model);

Which should result in:

My raw double quotes appears here "hello!"

Leave a Comment