All you need is: @Html.Raw(yourEncodedHtmlFromYouDatabase)
I’m assuming that the html in the database has been properly sanitized (or at least from a reliable source), because if not, you could be opening yourself up to cross-site scripting attacks.
The reason your approach didn’t work is that Razor HTML-encodes output by default (every time you use @
to display something). Html.Raw
tells Razor that you trust the HTML and you want to display it without encoding it (as it’s already raw HTML).