WebClient.Credentials gets or sets the network credentials : WebClient « Network Remote « VB.Net






WebClient.Credentials gets or sets the network credentials

 
Imports System.IO
Imports System.Net
Imports System.Text

public class MainClass
    Public Shared Sub Main()
        Try
            Dim client As New WebClient()
    
            client.Credentials = CredentialCache.DefaultCredentials
    
            Dim pageData As [Byte]() = client.DownloadData("http://www.domain.com")
            Dim pageHtml As String = Encoding.ASCII.GetString(pageData)
    
            Console.WriteLine(pageHtml)
    
        Catch webEx As WebException
            Console.Write(webEx.ToString())
        End Try
    End Sub
End Class

   
  








Related examples in the same category

1.WebClient Class
2.Create WebClient class.