473,667 Members | 2,749 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ftpWebResponse fails on alternate calls

I'm getting a list of files from an ftp site using the following method. On
the first call this works perfectly. On the 2nd call, it fails with the
following error. On the 3rd call it succeeds again.

"Failed to list incoming files from ftp site The remote server returned an
error: (550) File unavailable (e.g., file not found, no access)."

I'm guessing that the ftp server thinks the ftpUserID is already connected,
but I don't see any way to disconnect. Any suggestions?

- Jeremy

internal void listFiles(List< stringincomingF iles)
{
FtpWebRequest request =
(FtpWebRequest) WebRequest.Crea te(ftpPath);
request.UsePass ive = false;
request.Method = WebRequestMetho ds.Ftp.ListDire ctory;
request.Credent ials = new NetworkCredenti al(ftpUserID,
ftpPassword);
try
{
FtpWebResponse response =
(FtpWebResponse )request.GetRes ponse(); <== FAILS HERE.
Stream responseStream = response.GetRes ponseStream();
StreamReader reader = new StreamReader(re sponseStream);

incomingFiles.C lear();
string file = reader.ReadLine ();
while (file != null)
{
incomingFiles.A dd(file);
file = reader.ReadLine ();
}
reader.Close();
responseStream. Close();//jhg 06/16/2008
response.Close( ); //jhg 06/16/2008
}
catch (Exception ex)
{
onProgressEvent Args args = new onProgressEvent Args("Failed
to list incoming files from ftp site " + ex.Message);
showProgress(th is, args);
}
}

Jun 27 '08 #1
2 1925
On Jun 16, 2:14 pm, "Jeremy" <jeremy-nos...@ninproda ta.comwrote:
I'm getting a list of files from an ftp site using the following method. On
the first call this works perfectly. On the 2nd call, it fails with the
following error. On the 3rd call it succeeds again.

"Failed to list incoming files from ftp site The remote server returned an
error: (550) File unavailable (e.g., file not found, no access)."

I'm guessing that the ftp server thinks the ftpUserID is already connected,
but I don't see any way to disconnect. Any suggestions?

- Jeremy

internal void listFiles(List< stringincomingF iles)
{
FtpWebRequest request =
(FtpWebRequest) WebRequest.Crea te(ftpPath);
request.UsePass ive = false;
request.Method = WebRequestMetho ds.Ftp.ListDire ctory;
request.Credent ials = new NetworkCredenti al(ftpUserID,
ftpPassword);
try
{
FtpWebResponse response =
(FtpWebResponse )request.GetRes ponse(); <== FAILS HERE.
Stream responseStream = response.GetRes ponseStream();
StreamReader reader = new StreamReader(re sponseStream);

incomingFiles.C lear();
string file = reader.ReadLine ();
while (file != null)
{
incomingFiles.A dd(file);
file = reader.ReadLine ();
}
reader.Close();
responseStream. Close();//jhg 06/16/2008
response.Close( ); //jhg 06/16/2008
}
catch (Exception ex)
{
onProgressEvent Args args = new onProgressEvent Args("Failed
to list incoming files from ftp site " + ex.Message);
showProgress(th is, args);
}
}
is the ftp server load balanced? alternate calls succeed could mean
load balancing issue.. where one server does not have the file.
you could use a regular ftp client and connect to the server and see
what happens try it couple of times in a row.

just a thought..
Jun 27 '08 #2
"parez" <ps*****@gmail. comwrote in message
news:db******** *************** ***********@k30 g2000hse.google groups.com...
>
is the ftp server load balanced? alternate calls succeed could mean
load balancing issue.. where one server does not have the file.
you could use a regular ftp client and connect to the server and see
what happens try it couple of times in a row.
Not load balanced. FileZilla connects consecutively, although it asks
"break current connection?" each time. Interesting suggestion though.

Jeremy

Jun 27 '08 #3

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

Similar topics

3
2783
by: | last post by:
Hi, I have an unmanaged VC7 app calling a C# dotnet service. I'm using the VS2003 generated proxy class derived from CSoapSocketClientT. The client app works fine for most of my customers, but for some it appears to be upset by their firewall / proxy. If I use CSoapSocketClientT.SetProxy(NULL) to pick up the proxy settings from IE, attempting to call a web method fails on every second call with SOAP_CLIENT_SEND_ERROR, any idea on...
15
2051
by: phil-news-nospam | last post by:
This question is borderline between language and programming, but I want to focus more on the language standards issue, rather than the programming issue, so I am posting here. I have a number of functions which are front-ended by macros which make some changes in the way the functions are called. There are various things being done, but one simple example would be a function that takes a variable number of (const char *) arguments and...
3
2800
by: Benjamin Gavin | last post by:
Hi all, I recently stumbled upon a bug in the ASP.NET framework handling of ImageButton based postbacks. The issues derives from the fact that IE and Mozilla handle the case of a missing image file differently. In both cases, the setup for the problem is: 1. Create a form with an ImageButton whose ImageURL is invalid, specify an AlternateText value 2. Submit the form through that ImageButton
4
2277
by: sconeek | last post by:
Hi all, I am generating a html based table with multiple rows of data coming in real time from a postgres DB. The underlying technology is java based however the front end is html. now i am unable to alternate the colour of every row so that the table is lot more readable. can anyone suggest a javascript or even a css script which will alternate the row colours irrespective of the number of rows.
1
4345
by: Eric Lindsay | last post by:
I am trying to understand the differences between and uses of persistent, default and alternate styles. I have read http://www.w3.org/TR/REC-html40/present/styles.html section 14.3.2 on specifying external style sheets in link using combinations of rel and using or not using the title attribute. I think I sort of understand rel="alternate stylesheet". It seems to be able to act something like the media="print" or media="handheld" or...
9
2494
by: johkar | last post by:
I need some browser implementation clarification. In the below example, the alternate stylesheet could be invoked by user agents that support alternate stylesheets or by script. Are there any browsers that don't recognize "alternate stylesheet" as a value of the rel attribute and just implement it automatically thus overriding sheet2.css? Just need to know what I need to worry about. <link href="sheet1.css" rel="stylesheet"...
1
1755
by: raevian | last post by:
Hi, I have tried using FtpWebResponse however what I am getting is this error: An unhandled exception of type 'System.Net.WebException' occurred in System.dll Additional information: The underlying connection was closed: An unexpected error occurred on a receive. What should be the reason for this?Kindly help me! By the way I am very much sure that I am using the correct username and password. Any help, please? Thanks!
1
1692
by: Chris Ashley | last post by:
I'm using FTPWebRequest/FTPWebResponse to access a file over FTP, which I then want to send to the Response.OutputStream. How can I do this? I know I could populate an array of bytes in memory from the stream and then send that to the Response, but that solution isn't really viable due to the size of some of the files.
7
2086
by: Jeremy | last post by:
I'm finding very limited number of places where there is a dialog on ftpWebResponse. Can anyone suggest a place to try?
0
8458
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8366
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8888
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8565
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7391
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5677
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4202
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2779
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2017
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.