Precisando exibir algum texto em formato Html na sua página? Segue código em VB.Net para isso.
Public Shared Function HtmlEncode(ByVal texto As String) As String
Dim caracteres() As Char = System.Web.HttpUtility.HtmlEncode(texto).ToCharArray
Dim resultado As New System.Text.StringBuilder(texto.Length + CInt(texto.Length * 0.1))
For Each c As Char In caracteres
Dim valor As Integer = Convert.ToInt32(c)
If valor > 127 Then
resultado.AppendFormat("&#{0};", valor)
Else
resultado.Append(c)
End If
Next
Return resultado.ToString()
End Function
Abraço!
//Cleydson