When we want to displayHtmlWhen marking, if the webpage directly outputs the information, it will be interpreted by the browserHtmlSo you needServerObjectHtmlencodeMethod to encode and output it. To return the encoded result to the original content, useHtmldecodeMethod. BelowProgramCodeExampleHtmlencodeIn 「<B> htmlContent</B>Encode the code and output it to the browser for reuse.HtmldecodeThe decoding method restores the encoded result:
<HTML>
<Script language = "VB" runat = "server">
Sub page_load (sender as object, e as eventargs)
Dim strhtmlcontent as string
Strhtmlcontent = server. htmlencode ("<B> htmlContent</B> ")
Response. Write (strhtmlcontent)
Response. Write ("<p> ")
Strhtmlcontent = server. htmldecode (strhtmlcontent)
Response. Write (strhtmlcontent)
End sub
</SCRIPT>
</Html>
the output of the above sample can be found, the encoded HTML label is changed to & lt; B & gt; HTML content & lt;/B & gt; , this is because is changed to & lt; B & gt; , is changed to & lt;/B & gt; , so we can display the HTML Annotation on the page.