Reputation: 141
I got html tagged string like
<p>I want to trip/remove seconds from date time.
I checked some solution but showing solution using
format string like
</p>
<pre><code class="language-c#">
DateTime datetime = DateTime.UtcNow;
</code></pre>
as result of my controllers action passed down into view. How I can decode it into html formatting inside from html? Or maybe I can someway generate html page in my action and append it to existing document?
Upvotes: 0
Views: 344
Reputation: 2110
Use @Html.Raw()
:
@Html.Raw(htmlString)
And I agree with Ali's comment.
Using HtmlHelper.Raw on unsanitized user input is a security risk. User input might contain malicious JavaScript or other exploits. Sanitizing user input is difficult. Avoid using HtmlHelper.Raw with user input.
Upvotes: 2