WebResponse.Headers Property gets a collection of header name-value pairs associated with this request.
Imports System.IO
Imports System.Net
Imports System.Text
publicclass MainClass
Shared Sub Main()
Dim myWebRequest As WebRequest = WebRequest.Create("www.domain.com")
Dim myWebResponse As WebResponse = myWebRequest.GetResponse()
Console.WriteLine(ControlChars.Cr + "The following headers were received in the response")
Dim i As Integer
While i < myWebResponse.Headers.Count
Console.WriteLine(myWebResponse.Headers.Keys(i))
Console.WriteLine(myWebResponse.Headers(i))
i = i + 1
End While
myWebResponse.Close()
End Sub
End Class