2

How would I get this:

<code class="language-markup">@Html.Partial("components")</code>

To output the encoded version of the HTML markup? I tried the httpUtility but it threw up a few errors.

2

1 Answer 1

5

I think just call the encode

<code class="language-markup">
    @Html.Encode(Html.Partial("components"))
</code>
Sign up to request clarification or add additional context in comments.

1 Comment

while this works in ASP.NET MVC, unfortunately, this one does not work with ASP.NET Core 2.x

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.