Create WebClient class. : WebClient « Network Remote « VB.Net






Create WebClient class.

 
Imports System.IO
Imports System.Net
Imports System.Text
Imports System.Collections.Specialized
Public Class MainClass
    Public Shared Sub Main()
            Dim client As New WebClient()
            Dim pageData As [Byte]() = client.DownloadData("http://www.domain.com")
            Dim pageHtml As String = Encoding.ASCII.GetString(pageData)

            Console.WriteLine(pageHtml)
            client.DownloadFile("http://www.domain.com", "page.htm")
            Dim form As New NameValueCollection()
            form.Add("MyName", "MyValue")
            Dim responseData As [Byte]() = client.UploadValues("http://www.domain.com/form.aspx", form)
            Console.WriteLine(Encoding.ASCII.GetString(responseData))
    End Sub
End Class

   
  








Related examples in the same category

1.WebClient Class
2.WebClient.Credentials gets or sets the network credentials