AJM
AJM

Reputation: 32490

How do you output html as code on asp.net page?

I want to dump out some HTML I am rendering in a C# class on an ASPX page. But not as the rendered HTML but the actual HTML before the browser renders it.

Is this possible?

Upvotes: 0

Views: 124

Answers (2)

ScottE
ScottE

Reputation: 21630

HttpUtility.HtmlEncode()

EDIT

If you take a look in reflector, you'll see that Server.HtmlEncode() calls HttpUtility.HtmlEncode()

Upvotes: 1

Arjan Einbu
Arjan Einbu

Reputation: 13692

Server.HtmlEncode should do the trick...

Upvotes: 6

Related Questions