Create StreamReader from URL : URL « Socket Network « VB.Net Tutorial






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




   








22.1.URL
22.1.1.Read from a URL
22.1.2.Create StreamReader from URL