473,386 Members | 1,630 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

FTPWebRequest failing - URGENT

I am using .NET 2.0 new classed for FTP download purpose. I have
requirement to connect with 3 different FTP and download all files
list and see if file exist at my end. if not then i need to download.
I am keeping my configuration in XML file so that i can use my same
code and i simply iterate on my configuration data. 1st FTP connect
works fine but 2nd FTP does not connect and return with following
error message. After this failure when my code attemp to for the 3rd
FTP, it works. but it also fail on Download file for 3rd FTP on some
files. I could not find any specific reason for this exception. If i
make my failing FTP as 1st one, so in general my second FTP request in
my loop fails. i tested 3 ftp in internet explorer and they work fine.
but in .NET 2.0 new classes i can see these un knonw behaviours. any
suggestion on improving code or setting some other property which i am
missing?????????????
The remote server returned an error: (503) Bad sequence of commands.
I further trace the error line, it is coming on following line,
response = reqFTP.GetResponse()

here is my code below which works well for 1st FTP Request but it
fails on 2nd FTP.
reqFTP = System.Net.FtpWebRequest.Create(New Uri("ftp://"
+ Me.FTP_Address))
reqFTP.KeepAlive = True
reqFTP.UseBinary = True
reqFTP.Credentials = New
System.Net.NetworkCredential(Me.FTP_User, Me.FTP_Password)
reqFTP.Method =
System.Net.WebRequestMethods.Ftp.ListDirectory
response = reqFTP.GetResponse()
reader = New
System.IO.StreamReader(response.GetResponseStream( ))
line = reader.ReadLine()
While (Not line Is Nothing)
result.Append(line)
result.Append(",")
line = reader.ReadLine()
End While
' to remove the trailing ','
result.Remove(result.ToString().LastIndexOf(","), 1)
reader.Close()
It is URGENT for me to resolve this issue, otherwise i will have to
switch to a 3rd Party FTP component. I was excited about 2.0 new
classes and i hope this issue will resolve with some one's feedback.

Jun 15 '07 #1
1 9268
I figured it out now. 1st of all i was not setting up KeepAlive
property at all. Then i thought i should setup it as TRUE as default
may be FALSE. but it did not work out. Then i setup it to FALSE
explicitly and now every thing is working fine.

Jun 15 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Kevin Spencer | last post by:
Hi all, I am working on a service that uploads METAR weather information to the National Weather Service FTP site. The service I'm authoring is hosted on a Windows 200 server, and the NWS FTP...
7
by: jose.lopes.cruz | last post by:
I need to access a FTP Server. I'm using FTPWebRequest as described in visual studio 2005 documentation. Everything works fine except the following: 1) I dont know how to change de current...
6
by: ajit | last post by:
I am working on web service which in turn call com components. if # of users using the web service increases. Web service fails is there some why I can prevent max # of concurrent users using the...
0
by: Alexis | last post by:
Hello, I am trying to upload a file to an ftp server using the FtpWebRequest class, but I get the following error. The requested URI is invalid for this FTP command. I do can upload the file...
3
by: Kevien Lee | last post by:
hi everyone I have a quick question when i use the FtpWebRequest. What I need to do is that: Connect a FTP server,check whether there is a folder if not,create it, then changed the path to...
0
by: Buddy Home | last post by:
Hello, I'm trying to upload a file programatically and occasionally I get the following error message. Unable to write data to the transport connection: An established connection was aborted...
6
by: William LaMartin | last post by:
Could someone show me how to use the FtpWebRequest and change to a different directory? Changing directories is not listed as one of the methods, but I believe it can be done--just can't figure...
9
by: Waldy | last post by:
Hi there, I have written a service in VS2005 that downloads files from an FTP site processes them and then deletes the files if successfully processed. It all works fine when run in our test lab...
6
by: Patrick.Simons | last post by:
I try to connect a FTPWebRequest through Proxy and VPN to a remote FTP- server. Sometimes it works sometimes not. When my VB.Net-App (2005) returns the error on the GetResponse-Method, I'll try to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.