I am sending HTML news letters and composing them run-time. I need to put HTML code as string in the HTML news letter. Since the HTML code I need to place as a string is also html it executes in the browser but I dont want this, I want to display that code itself. Any help will be appreciated.
2 Answers
Wrap the HTML in <code> or <pre> tags
and make sure you use an HTML entity encoder on the code first so that it will display < and > properly.
1 Comment
PaulProgrammer
For added fun, if you can execute javascript, you can use something like SyntaxHighlighter (alexgorbatchev.com/SyntaxHighlighter) to make the code all purty-like.