In an ASP Classic (aspx) web form, I could render the whole HTML in a PRE tag like this:
Webpage:
<pre><asp:label id="ContentBox" runat="server"></asp:label></pre>
ContentBox.Text = html string;
Then the whole HTML is rendered on the webpage correctly.
I am wondering how I could do the same thing in an ASP.NET MVC Razor view. For now, what I see is a raw HTML string.
The HTML string could be like this:
<?xml version="1.0" encoding="utf-8"?>
<html>
<head>
<title>A title</title>
<style>
.td_header {background-color: white; text-align:left}
.table_header {background-color: white; width: 100%}
</style>
</head>
<body>
<table style="table_header" frame="void">
<tr>
<td class="td_header">
<img src="logo_v3.jpg" alt="Helping" width="261" height="50" />
</td>
</tr>
</table>
</body>
</html>
This should do it:
<pre>@Html.Raw(Model.HtmlString)</pre>