Computing.Net > Forums > Programming > Web File Download in VB.NET

Computing.Net: Over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to sign up now, it's free!

Web File Download in VB.NET

Reply to Message Icon

Original Message
Name: drigz
Date: March 27, 2004 at 07:02:39 Pacific
Subject: Web File Download in VB.NET
OS: winxp pro
CPU/Ram: -
Comment:

how can I download a file from a url in vb.net? i tried this code:

http://www.vbdotnetheaven.com/Code/Jul2003/2107.asp

but vb.net said that WebRequestFactory wasn't defined.

thanks.


Report Offensive Message For Removal


Response Number 1
Name: drigz
Date: March 27, 2004 at 10:22:27 Pacific
Reply: (edit)

yay! found it!

Sub DownloadFile(ByVal uri As String, ByVal destFile As String, _
Optional ByVal username As String = Nothing, Optional ByVal pwd As String = _
Nothing)
Dim wc As New System.Net.WebClient
If Not username Is Nothing AndAlso Not pwd Is Nothing Then
wc.Credentials = New System.Net.NetworkCredential(username, pwd)
End If

wc.DownloadFile(uri, destFile)
End Sub


Report Offensive Follow Up For Removal







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home








Do you have your own blog?

Yes
No
I did before
I will soon


View Results

Poll Finishes In 4 Days.
Discuss in The Lounge
Poll History




Data Recovery Software