0
下面的代碼:ASP.net:FTP問題,試圖從一個FTP移動ASPX文件到另一個
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 As System.Net.FtpStatusCode = ftpSourceResponse.StatusCode
Dim responseStream As 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 As Exception
response.Close()
ftpSourceResponse.Close()
End Try
的問題是,當我真正從我的來源下載的文件,然後將其上傳到我的目的地。該文件中的唯一的事情就是一段文字,說:「就是System.IO.StreamReader」我在做什麼錯在這裏?
其實,這也正是它是什麼。不知何故,ReadToEnd的被覆蓋。調查源頭控制以找到罪魁禍首。 – jlrolin 2010-11-15 22:04:03