.net - ASP.net: FTP issue, trying to move ASPX files from one FTP to another -
here's code:
response.close() ftpwebrequest = webrequest.create(ftp_location & dr("file_location").tostring.replace("~", "")) ftpwebrequest.credentials = new networkcredential(ftp_user, ftp_pw) ftpwebrequest.method = webrequestmethods.ftp.uploadfile ftpwebrequest.usebinary = true ftpsourcerequest = webrequest.create(ftp_source & dr("file_location").tostring.replace("~", "")) ftpsourcerequest.credentials = new networkcredential(ftp_user, ftp_pw) ftpsourcerequest.method = webrequestmethods.ftp.downloadfile ftpsourcerequest.usebinary = true try ftpsourceresponse = ftpsourcerequest.getresponse() dim t system.net.ftpstatuscode = ftpsourceresponse.statuscode dim responsestream io.stream = ftpsourceresponse.getresponsestream ftpstreamwriter = new streamwriter(ftpwebrequest.getrequeststream()) ftpstreamwriter.write(new streamreader(responsestream).readtoend) dr("status") = "ok" dr.acceptchanges() ftpstreamwriter.close() response.close() ftpsourceresponse.close() catch ex4 exception response.close() ftpsourceresponse.close() end try
the problem when download file source, upload destination. thing in file piece of text says "system.io.streamreader" doing wrong here?
i didn't see stands out wrong.
the "system.io.streamreader" getting expected result if line:
ftpstreamwriter.write(new streamreader(responsestream).readtoend)
was this:
ftpstreamwriter.write(new streamreader(responsestream))
can double check .readtoend in there in version testing , if compiled ok?
assuming isn't issue, happens if do:
dim stowrite string = new streamreader(responsestream).readtoend debug.write(stowrite) ftpstreamwriter.write(stowrite)
checking string @ least tell if reading data correctly.
you don't include lot of type definitions had guess on types, might want try turning on option strict see if catches type issues didn't notice.
Comments
Post a Comment