I've got safe/sanitized HTML saved in a DB table.
How can I have this HTML content written out in a Razor view?
It always escapes characters like <
and ampersands to &
.
asp.net-mvcasp.net-mvc-3razor
I've got safe/sanitized HTML saved in a DB table.
How can I have this HTML content written out in a Razor view?
It always escapes characters like <
and ampersands to &
.
Best Answer
Supposing your content is inside a string named
mystring
...You can use:
Alternatively you can convert your string to
HtmlString
or any other type that implementsIHtmlString
in model or directly inline and use regular@
: