H
Hugh McLaughlin
Hello everyone and thanks for your help in advance. I am
working on an application that allows a user to downlad a
zip file from an FTP site. I have used the following
code:
Dim URL As String = "f= "ftp://ftpsite/data.zip"
Dim outputFile As String = "C:\Data.zip"
Dim wReq As WebRequest
Dim wResp As WebResponse
Dim respStream As Stream
Dim reader As StreamReader
Dim writer As StreamWriter
' create the Web Request
wReq = WebRequest.Create(URL)
' get the response
wResp = wReq.GetResponse()
respStream = wResp.GetResponseStream()
reader = New StreamReader(respStream,
Encoding.ASCII)
' and write it to the required file
writer = New StreamWriter(outputFile)
writer.Write(reader.ReadToEnd())
However, the application fails to work. I have verified
that the FTP site is configured properly and works, so
the problem is in my code. I am not exactly sure what is
wrong. Any help would be greatly appreciated. Thanks.
working on an application that allows a user to downlad a
zip file from an FTP site. I have used the following
code:
Dim URL As String = "f= "ftp://ftpsite/data.zip"
Dim outputFile As String = "C:\Data.zip"
Dim wReq As WebRequest
Dim wResp As WebResponse
Dim respStream As Stream
Dim reader As StreamReader
Dim writer As StreamWriter
' create the Web Request
wReq = WebRequest.Create(URL)
' get the response
wResp = wReq.GetResponse()
respStream = wResp.GetResponseStream()
reader = New StreamReader(respStream,
Encoding.ASCII)
' and write it to the required file
writer = New StreamWriter(outputFile)
writer.Write(reader.ReadToEnd())
However, the application fails to work. I have verified
that the FTP site is configured properly and works, so
the problem is in my code. I am not exactly sure what is
wrong. Any help would be greatly appreciated. Thanks.