' Create the request. Dim request As FtpWebRequest = FtpWebRequest.Create("ftp://ftp.philosophaie.com/GraphingPlanets.zip") request.Credentials = New NetworkCredential("ftpuser", "pass") request.KeepAlive = False request.UseBinary = True request.UsePassive = True request.Method = WebRequestMethods.Ftp.DownloadFile ' Save the file to the file system. Using response As System.Net.FtpWebResponse = CType(request.GetResponse, System.Net.FtpWebResponse) Using responseStream As IO.Stream = response.GetResponseStream Using fs As New IO.FileStream(Server.MapPath("\ftp1\GraphingPlanets.zip"), IO.FileMode.Create) Dim buffer(2047) As Byte Dim read As Integer = 0 Do read = responseStream.Read(buffer, 0, buffer.Length) fs.Write(buffer, 0, read) Loop Until read = 0 responseStream.Close() fs.Flush() fs.Close() End Using responseStream.Close() End Using response.Close() End Using
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)