Server.HtmlEncode vs HttpUtility.HtmlEncode
Posted by Tihomir Ivanov on 28 September 2009 07:37
Rating: 0.00
You may wonder what's the difference between Server.HtmlEncode and HttpUtility.HtmlEncode.
Actually, Server is an instance of HttpServerUtility:
Public ReadOnly Property Server As HttpServerUtility
Get
If (Me._server Is Nothing) Then
Me._server = New HttpServerUtility(Me)
End If
Return Me._server
End Get
End Property
And as noted HttpServerUtility.HtmlEncode makes a straight call to the shared method HttpUtility.HtmlEncode
Public Sub HtmlEncode(ByVal s As String, ByVal output As TextWriter)
HttpUtility.HtmlEncode(s, output)
End Sub
So for best performance, you could call directly to HttpUtility.HtmlEncode yourself.
Comments:
No comments yet.