Hi
I wanted to be able to download a file from a web server using the downloadfile method. I have successfully managed to download the file (which is a small text file), however the text file is empty when it should have text in it. My download code is as follows
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim sFile As String
sFile = "enquiries.txt"
Dim destination As String
destination = "F:\bushire\"
Dim sRemoteUrl As String
sRemoteUrl = " + sFile
'download file
GetPackage(sFile, destination, sRemoteUrl)
End Sub
Public Sub GetPackage(ByVal sFile As String, ByVal destination As String, ByVal sRemoteUrl As String)
'Downloads the enquiries file and stores it in the destination address with the same name
Dim wc As New Net.WebClient
Try
wc.DownloadFile(sRemoteUrl, sFile)
MsgBox("download successful"
Catch
MsgBox("Unable to download file " + sRemoteUrl)
End Try
End Sub
Any help would be great,
Thanks in advance,
aspro
I wanted to be able to download a file from a web server using the downloadfile method. I have successfully managed to download the file (which is a small text file), however the text file is empty when it should have text in it. My download code is as follows
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim sFile As String
sFile = "enquiries.txt"
Dim destination As String
destination = "F:\bushire\"
Dim sRemoteUrl As String
sRemoteUrl = " + sFile
'download file
GetPackage(sFile, destination, sRemoteUrl)
End Sub
Public Sub GetPackage(ByVal sFile As String, ByVal destination As String, ByVal sRemoteUrl As String)
'Downloads the enquiries file and stores it in the destination address with the same name
Dim wc As New Net.WebClient
Try
wc.DownloadFile(sRemoteUrl, sFile)
MsgBox("download successful"
Catch
MsgBox("Unable to download file " + sRemoteUrl)
End Try
End Sub
Any help would be great,
Thanks in advance,
aspro