WebClient Class : WebClient « Network Remote « VB.Net

WebClient Class

Imports System
Imports System.Net
Imports System.IO

Public Class Test

    Public Shared Sub Main(args() As String)
        Dim client As New WebClient()
        client.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)")

        Dim data As Stream = client.OpenRead("http://google.com")
        Dim reader As New StreamReader(data)
        Dim s As String = reader.ReadToEnd()
    End Sub 'Main
End Class 'Test


Related examples in the same category

1.Create WebClient class.
2.WebClient.Credentials gets or sets the network credentials