0
我使用任何第三方工具FTP文件傳輸
這是我的代碼中使用vb.net從遠程計算機上的文件傳輸到本地機器了編寫代碼
Dim reqFTP As FtpWebRequest
Dim filepath As String
Dim filename As String
Dim filename1 As String
Dim ftpserverip As String
Dim ftpuserid As String
Dim ftpPassword As String
Try
filename1 = TxtRemoteFile.Text
filepath = TxtLocalFile.Text
filename = Locfname.Text
ftpserverip = TxtServerIP.Text
ftpuserid = TxtUserName.Text
ftpPassword = TxtPwd.Text
Dim outputStream As FileStream = New FileStream((filepath + ("\\" + filename)), FileMode.Create)
reqFTP = CType(FtpWebRequest.Create(New Uri(("ftp://" _
+ (ftpserverip + ("/" + filename1))))), FtpWebRequest)
reqFTP.Method = WebRequestMethods.Ftp.DownloadFile
reqFTP.UseBinary = True
reqFTP.Credentials = New NetworkCredential(ftpuserid, ftpPassword)
Dim response As FtpWebResponse = CType(reqFTP.GetResponse, FtpWebResponse)
outputStream.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
,但我得到的錯誤,如」遠程服務器返回錯誤:(550)網絡
你確定你在ftp服務器上有寫權限嗎? – 2012-02-23 08:46:00
我會打開'關於所有錯誤',並查看哪條線路出現故障。另外:550錯誤是來自服務器的消息,指出您當前登錄的帳戶沒有執行您嘗試執行的操作的權限。 – 2012-02-23 09:47:01