Reputation: 91
I have a following string variable:
string example = "<div class=\"content\">" + Environment.NewLine + "[some content here]" + "/div";
How can I render it as html markup in the page body?
Upvotes: 0
Views: 222
Reputation: 7403
Use Html-raw:
<body>
@Html.Raw(example)
</body>
(However I would do it with caution. It is always best not to make HTML with strings if possible, as it poses a security risk and causes maintenance issues.)
Upvotes: 5