0
我使用此代碼將文件上載到服務器。將文件上傳到遠程服務器時無法連接到遠程服務器
Dim clsRequest As System.Net.FtpWebRequest = _
DirectCast(System.Net.WebRequest.Create(a), System.Net.FtpWebRequest)
clsRequest.Credentials = New System.Net.NetworkCredential(username, pwd)
clsRequest.Method = System.Net.WebRequestMethods.Ftp.UploadFile
' read in file...
Dim bFile() As Byte = System.IO.File.ReadAllBytes(pdfPath)
' upload file...
Dim clsStream As System.IO.Stream = _
clsRequest.GetRequestStream()
clsStream.Write(bFile, 0, bFile.Length)
clsStream.Close()
clsStream.Dispose()
但是顯示錯誤無法在線路暗淡clsStream連接到遠程服務器作爲System.IO.Stream = _ clsRequest.GetRequestStream()。任何錯誤?
你確定你通過正確的FTP Uri和憑證嗎? – Alexander
錯誤是在行開始Dim clsStream As System.IO.Stream = _ clsRequest.GetRequestStream() – user2562841
或者我如何檢查FTP Uri和憑證? – user2562841