1 Replies - 1792 Views - Last Post: 12 August 2013 - 10:03 AM Rate Topic: -----

#1 STP_Captain_Slow   User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 89
  • Joined: 08-October 10

FTP Delete File Timeout

Posted 12 August 2013 - 10:01 AM

Hi

I am writing an FTP upload program which checks if a file exists, if it does it downloads a file list of all the files that contains the file name then deletes all the files then uploads the new file, otherwise if it doesn't exist it just uploads. The straight forward uploads works fine, however i have a problem if the there is more than one file list that needs to be deleted. On the second time round it always times out.

Private Sub DeleteFile(ByVal fileName As String)
        FTPSettings.IP = "111.111.111.111"
        FTPSettings.UserID = "user"
        FTPSettings.Password = "password"

        Dim reqFTP As FtpWebRequest = Nothing
        Try
            reqFTP = DirectCast(FtpWebRequest.Create(New Uri("ftp://" & FTPSettings.IP & "/httpdocs/Content/Images/" & fileName)), FtpWebRequest)
            reqFTP.Method = WebRequestMethods.Ftp.DeleteFile
            reqFTP.UseBinary = True
            reqFTP.Credentials = New NetworkCredential(FTPSettings.UserID, FTPSettings.Password)

            Dim ftpResponse As FtpWebResponse = CType(reqFTP.GetResponse(), FtpWebResponse)
            ftpResponse = reqFTP.GetResponse()
            'ftpResponse.Close()
        Catch ex As Exception
            Throw New Exception(ex.Message.ToString())
        End Try
    End Sub



Any suggestions would be great as i can't understand how it can delete 4 files from one file list then is timeouts out on the second time round.

Many Thanks

Is This A Good Question/Topic? 0
  • +

Replies To: FTP Delete File Timeout

#2 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 14151
  • View blog
  • Posts: 56,726
  • Joined: 12-June 08

Re: FTP Delete File Timeout

Posted 12 August 2013 - 10:03 AM

.. and there are no exceptions thrown?

Perhaps disposing of the webrequests and closing out the connections may help.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1