Imports System.Net
Imports System.IO
Module Test
Sub Main()
Dim sURL As String
sURL = "http://msdn.microsoft.com"
Try
Dim objNewRequest As WebRequest = HttpWebRequest.Create(sURL)
Dim objResponse As WebResponse = objNewRequest.GetResponse
Dim objStream As New StreamReader(objResponse.GetResponseStream())
Console.WriteLine(objStream.ReadToEnd())
Catch eUFE As UriFormatException
Console.WriteLine(eUFE.Message)
Catch eWEB As WebException
Console.WriteLine(eWEB.Message)
Catch e As Exception
Console.WriteLine(e.ToString)
End Try
End Sub
End Module
|