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!
6
votes
1 Answers
12
votes
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
WebClient, set theCredentialsproperty and call theDownloadFilemethod. - jmcilhinney