Private Function EnviaArchivo()
Try
Dim UserName, Password, Direccion As String
UserName = "usuario"
Password = "password"
Direccion = "ftp://ftp.pagina.com"
Dim client As New System.Net.WebClient
client.Credentials = New System.Net.NetworkCredential(UserName, Password)
client.UploadFile("ftp://ftp.paginacom", "C:\Carpeta\Archivoasubir.zip")
MsgBox("Se subió el archivo")
Catch ex As Exception
MsgBox("No se puede subir el archivo " + ex.ToString)
End Try
End Function
Private Sub DescargaArchivo()
Try
Dim client As New System.Net.WebClient
client.Credentials = New System.Net.NetworkCredential("usuario", "password")
client.DownloadFile("ftp.pagina.com", "archivoasubir.zip")
MsgBox("Se ha descargado correctamente el archivo")
Catch ex As Exception
MsgBox("Error al descargar archivo: " + ex.ToString)
End Try
End Sub