using RazorEngine outside asp.net I'm experiencing this error when I try to write raw html by using @Html.Raw("html string here")
:
Unable to compile template. The name 'Html' does not exist in the current context
Can you help me?
Thanks!
using RazorEngine outside asp.net I'm experiencing this error when I try to write raw html by using @Html.Raw("html string here")
:
Unable to compile template. The name 'Html' does not exist in the current context
Can you help me?
Thanks!
I implemented my own Raw whose result implements both IHtmlString and IEncodedString... and it worked! :)
This works both when MVC uses it and when the RazorEngine parser uses it.
The solution has been found here: https://github.com/Antaris/RazorEngine/issues/34
It's enough to use
@(new RawString("html string here"))
or@Raw("html string here")
instead of@Html.Raw("html string here")
.I hope this helps! Bye