Skip to content
Strandedpirate edited this page May 4, 2012 · 4 revisions

Encoding:

By default RazorEngine is configured to encode as Html. This sometimes this presents problems were certain characters are encoded as Html but what you want is to output them 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!"

Clone this wiki locally