I seem to be having a problem with the FTPWebRequest. I get an error (see below code) when it executes the emboldened line. Any ideas?
"The server returned an address in response to the PASV command that is different than the address to which the FTP connection was made."Code:Dim uploadRequest As FtpWebRequest = WebRequest.Create(uploadUrl) uploadRequest.Method = WebRequestMethods.Ftp.UploadFile If strUserName <> "" And strPassword <> "" Then uploadRequest.Credentials = New System.Net.NetworkCredential(strUserName, strPassword) End If uploadRequest.EnableSsl = blnSecure uploadRequest.KeepAlive = True uploadRequest.UsePassive = blnPassive uploadRequest.Proxy = Nothing RequestStream = uploadRequest.GetRequestStream() fileStream = File.Open(fileName, FileMode.Open) Dim buffer(1024) As Byte Dim bytesRead As Integer While True bytesRead = fileStream.Read(buffer, 0, buffer.Length) If bytesRead = 0 Then Exit While End If requestStream.Write(buffer, 0, bytesRead) End While ' The request stream must be closed before getting the response. requestStream.Close() uploadResponse = uploadRequest.GetResponse()





Reply With Quote