The requested url is not valid for this ftp command

2

I'm having problems trying to download a file via FTP, I get the error and the visibility of the install and start buttons is not changed and the idea is when the FTP server files are downloaded change the opacity of the two for that this button to start instead of the install

  

The requested URI is not valid for this FTP command.

    Private Sub Botonweon2_Click(sender As Object, e As EventArgs) Handles Botonweon2.Click
        If (Not Directory.Exists("C:\Program Files\DEV_RETARDS\APOCALYPSE")) Then
            Directory.CreateDirectory("C:\Program Files\DEV_RETARDS\APOCALYPSE")
        End If ' Crear directorio si no existe '
        Main()
        FTP()
        Botonweon.Visible = True ' Boton de Iniciar '
    End Sub
    Private Sub FTP()
        Dim localFile As String = "C:\Program Files\DEV_RETARDS\APOCALYPSE"
        Dim GAMENAME As String = "htdocs/APOCALYPSE/Descarga esto"
        Dim remoteFile As String = GAMENAME
        Const host As String = "ftp://ftpupload.net/" 'nombre de la carpeta en nuestro server FTP donde estan los archivos que deseamos descargar
        ' colocamos el nombre de usuario y password respectivo para acceder al server, si este no poseyera, dejar solo las comillas, osea ""
        Const username As String = "USER"
        Const password As String = "PASS"
        Dim URI As String = host + remoteFile ' nombre completo de la ruta del archivo
        Dim ftp As System.Net.FtpWebRequest = CType(Net.FtpWebRequest.Create(URI), Net.FtpWebRequest)
        ftp.Credentials = New _
System.Net.NetworkCredential(username, password)
        ftp.KeepAlive = False
        ftp.UseBinary = True
        ftp.Method = System.Net.WebRequestMethods.Ftp.DownloadFile
        Try
            Using response As System.Net.FtpWebResponse =
CType(ftp.GetResponse, System.Net.FtpWebResponse)
                Using responseStream As IO.Stream = response.GetResponseStream
                    Using fs As New IO.FileStream(localFile, 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
        Catch ex As Exception
           Dim strError As String = ex.ToString()
        End Try
        Botonweon2.Visible = False ' Boton de Instalar '
    End Sub

Output: 'Demo.exe' (CLR v4.0.30319: Demo.exe): 'C: \ WINDOWS \ Microsoft.Net \ assembly \ GAC_MSIL \ System.resources \ v4.0_4.0.0.0_en_b77a5c561934e089 \ System.resources .dll 'loaded. The module was compiled without symbols. Exception produced: 'System.Net.WebException' in System.dll

Captured in variable strError:

    
asked by Gabri2233 31.12.2018 в 14:57
source

0 answers