HttpServerUtility contains a public function called UrlEncode. It is not a shared function. HttpServerUtility does not have any public constructors.
Doing this fails:
Dim encodeMe As String = "a string to be encoded!"
HttpServerUtility.UrlEncode(encodeMe) 'Bombs out
This works, and is how Microsoft says to do it:
Dim instance As HttpServerUtility
Dim encodeMe As String = "a string to be encoded!"
instance.UrlEncode(encodeMe ) 'Works!
How did they accomplish this? You can't instantiate an instance of it using a constructor, yet you can't access UrlEncode by just referencing HttpServerUtility.UrlEncode.
EDIT: While I thoroughly enjoyed everyone getting into a big OO debate, I believe the problem is faulty MSDN documentation. The line "Dim instance As HttpServerUtility" should read "Dim instance As HttpServerUtility = Context.Server" The code which I included (which is from the MSDN documentation) does not actually work, and instead throws a null reference exception - just as you'd expect. Thank you, Jason!