Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
690 views
in Technique[技术] by (71.8m points)

asp.net mvc - RazorEngine: cannot use Html.Raw

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!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...