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.java2s.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
CharacterSet: ISO-8859-1
ContentEncoding:
ContentLength: 343984
ContentType: text/html
LastModified: 17/04/2007 10:07:49 PM
Method: GET
ProtocolVersion: 1.1
ResponseUri: http://www.java2s.com/
Server: Apache/2.0.54 (Fedora)
StatusCode: OK
StatusDescription: OK
22.26.HttpWebRequest |
| 22.26.1. | Create HttpWebRequest |
| 22.26.2. | Connection, ConnectionGroupName, ContentLength, ContentType |
| 22.26.3. | MediaType |
| 22.26.4. | Method, PreAuthenticate, ProtocolVersion |
| 22.26.5. | Referer, RequestUri, RequestUri |
| 22.26.6. | TransferEncoding, UserAgent |
| 22.26.7. | HttpWebResponse and its properties |
| 22.26.8. | HaveResponse, IfModifiedSince, KeepAlive, MaximumAutomaticRedirections |