Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Download File From URL Code VB.NET

i would like ask about, how to download file from url by code vb.net?
example : Example Link before download the file, user MUST input Username and Password? how can i do that? any reference or link? thanks!

like image 264
Christian Yonathan S. Avatar asked Apr 26 '16 05:04

Christian Yonathan S.


People also ask

How to download a file using vb net?

To download a file, supplying a user name and password Use the DownLoadFile method to download the file, specifying the target file's location as a string or URI and specifying the location at which to store the file, the user name, and the password. This example downloads the file WineList.

How do I download a file using VS code?

Get an access token by clicking the extensions icon near the address bar. Browse to any GitHub repo and right-click the blank section near any file/folder and click "Download folder/file name as zip".


1 Answers

Use System.Net.WebClient.DownloadFile

Dim remoteUri As String = "http://belajar123.com/materi.zip"
Dim fileName As String = "materi.zip"
Dim password As String = "..."
Dim username As String = "..."

Using client as New WebClient()

    client.Credentials = New NetworkCredential(username, password)
    client.DownloadFile(remoteUri, fileName)
End Using
like image 51
Claudius Avatar answered Nov 15 '22 08:11

Claudius