Imports System.Net
Imports System.Net.Sockets
Public Class Tester
Public Shared Sub Main
Dim httpReq As System.Net.HttpWebRequest
Dim httpResp As System.Net.HttpWebResponse
Try
Dim httpURL As New System.Uri("http://www.java2java.com")
httpReq = CType(WebRequest.Create(httpURL), HttpWebRequest)
httpResp = CType(httpReq.GetResponse(), HttpWebResponse)
Console.WriteLine("CharacterSet: " & httpResp.CharacterSet.ToString)
Console.WriteLine("ContentEncoding: " & httpResp.ContentEncoding.ToString)
Console.WriteLine("ContentLength: " & httpResp.ContentLength.ToString)
Console.WriteLine("ContentType: " & httpResp.ContentType.ToString)
Console.WriteLine("LastModified: " & httpResp.LastModified.ToString)
Console.WriteLine("Method: " & httpResp.Method.ToString)
Console.WriteLine("ProtocolVersion: " & httpResp.ProtocolVersion.ToString)
Console.WriteLine("ResponseUri: " & httpResp.ResponseUri.ToString)
Console.WriteLine("Server: " & httpResp.Server.ToString)
Console.WriteLine("StatusCode: " & httpResp.StatusCode.ToString)
Console.WriteLine("StatusDescription: " & httpResp.StatusDescription.ToString)
Catch ex As Exception
Console.WriteLine(ex.StackTrace.ToString())
End Try
End Sub
End Class
|