|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
FtpWebRequestrequest.GetRequestStream. It worked fine with one FTP server and not with another. Dim request As FtpWebRequest Dim password As String Dim response As FtpWebResponse password = ConfigurationManager.AppSettings("ftppwd") request = WebRequest.Create(FTPlocation.Text) request.Method = WebRequestMethods.Ftp.UploadFile request.Credentials = New NetworkCredential(FTPAccount.Text, password) Dim io As Stream buff = out.ToString Dim b As Byte() b = Encoding.ASCII.GetBytes(buff) request.ContentLength = b.Length io = request.GetRequestStream io.Write(b, 0, b.Length) io.Close() It will be greatly helpful if you will tell the exception message that is
thrown Show quote "Arne" <A***@discussions.microsoft.com> wrote in message news:A798BF2E-B337-4DF9-A3AE-0A322B23807B@microsoft.com... > Can you find anything wrong with the code below? It blows up in io = > request.GetRequestStream. > It worked fine with one FTP server and not with another. > > Dim request As FtpWebRequest > Dim password As String > Dim response As FtpWebResponse > password = ConfigurationManager.AppSettings("ftppwd") > request = WebRequest.Create(FTPlocation.Text) > request.Method = WebRequestMethods.Ftp.UploadFile > request.Credentials = New NetworkCredential(FTPAccount.Text, > password) > Dim io As Stream > buff = out.ToString > Dim b As Byte() > b = Encoding.ASCII.GetBytes(buff) > request.ContentLength = b.Length > io = request.GetRequestStream > io.Write(b, 0, b.Length) > io.Close() System.Net.WebException: The remote server returned an error: 227 Entering
Passive Mode (209,98,235,43,4,4) . ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond at Show quote "Vadym Stetsyak" wrote: > It will be greatly helpful if you will tell the exception message that is > thrown > > -- > Vadym Stetsyak aka Vadmyst > http://vadmyst.blogspot.com > > "Arne" <A***@discussions.microsoft.com> wrote in message > news:A798BF2E-B337-4DF9-A3AE-0A322B23807B@microsoft.com... > > Can you find anything wrong with the code below? It blows up in io = > > request.GetRequestStream. > > It worked fine with one FTP server and not with another. > > > > Dim request As FtpWebRequest > > Dim password As String > > Dim response As FtpWebResponse > > password = ConfigurationManager.AppSettings("ftppwd") > > request = WebRequest.Create(FTPlocation.Text) > > request.Method = WebRequestMethods.Ftp.UploadFile > > request.Credentials = New NetworkCredential(FTPAccount.Text, > > password) > > Dim io As Stream > > buff = out.ToString > > Dim b As Byte() > > b = Encoding.ASCII.GetBytes(buff) > > request.ContentLength = b.Length > > io = request.GetRequestStream > > io.Write(b, 0, b.Length) > > io.Close() > > > Hmm, it seems that remote server didn't allow you to connect to it. There
can be a lot of reasons why remote server refused connection. To get more details about this situation it will be a good idea to enable network tracing and see what network I/O is happening. See, the details at ( http://msdn2.microsoft.com/a6sbz1dx.aspx ) Show quote "Arne" <A***@discussions.microsoft.com> wrote in message news:B383CAAE-F6D3-4FE2-9EB1-FED13138F742@microsoft.com... > System.Net.WebException: The remote server returned an error: 227 Entering > Passive Mode (209,98,235,43,4,4) . ---> > System.Net.Sockets.SocketException: A > connection attempt failed because the connected party did not properly > respond after a period of time, or established connection failed because > connected host has failed to respond at > Vadym,
I can connect fine with a program called LeechFTP. I can't connect with a program. I can't connect with a response file and command line ftp. Show quote "Vadym Stetsyak" wrote: > Hmm, it seems that remote server didn't allow you to connect to it. There > can be a lot of reasons why remote server refused connection. > > To get more details about this situation it will be a good idea to enable > network tracing and see what network I/O is happening. > > See, the details at > > ( http://msdn2.microsoft.com/a6sbz1dx.aspx ) > -- > Vadym Stetsyak aka Vadmyst > http://vadmyst.blogspot.com > > "Arne" <A***@discussions.microsoft.com> wrote in message > news:B383CAAE-F6D3-4FE2-9EB1-FED13138F742@microsoft.com... > > System.Net.WebException: The remote server returned an error: 227 Entering > > Passive Mode (209,98,235,43,4,4) . ---> > > System.Net.Sockets.SocketException: A > > connection attempt failed because the connected party did not properly > > respond after a period of time, or established connection failed because > > connected host has failed to respond at > > > > > That is why I've recommended you to use network tracing functionality.
It can be configured so that you can log all the traffic between your app and remote FTP server. Having this info you can determine the reason (analyze traffic log), why FTP server refuses connection. Show quote "Arne" <A***@discussions.microsoft.com> wrote in message news:C47F3EDC-D43A-4117-B2B9-05BB2404B6ED@microsoft.com... > Vadym, > I can connect fine with a program called LeechFTP. I can't connect with a > program. I can't connect with a response file and command line ftp. > > "Vadym Stetsyak" wrote: > >> Hmm, it seems that remote server didn't allow you to connect to it. There >> can be a lot of reasons why remote server refused connection. >> >> To get more details about this situation it will be a good idea to enable >> network tracing and see what network I/O is happening. >> >> See, the details at >> >> ( http://msdn2.microsoft.com/a6sbz1dx.aspx ) >> -- >> Vadym Stetsyak aka Vadmyst >> http://vadmyst.blogspot.com >> >> "Arne" <A***@discussions.microsoft.com> wrote in message >> news:B383CAAE-F6D3-4FE2-9EB1-FED13138F742@microsoft.com... >> > System.Net.WebException: The remote server returned an error: 227 >> > Entering >> > Passive Mode (209,98,235,43,4,4) . ---> >> > System.Net.Sockets.SocketException: A >> > connection attempt failed because the connected party did not properly >> > respond after a period of time, or established connection failed >> > because >> > connected host has failed to respond at >> > >> >> >> |
|||||||||||||||||||||||