473,383 Members | 1,801 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,383 software developers and data experts.

FTPWebRequest always timeouts


I am running the following code (using VS 2005) with the appropriate
username and password and the request always timeouts:

FtpWebRequest request =
(FtpWebRequest)WebRequest.Create("ftp://integration300:20/");
request.Method = WebRequestMethods.Ftp.ListDirectory;
request.UsePassive = false;
request.Credentials = new
NetworkCredential(<user>,<password>);
request.Proxy = null;

FtpWebResponse response =
(FtpWebResponse)request.GetResponse();
response.Close();

If I perform the query "ftp://integration300" in IE then I can see all the
available drives as expected. I can also access the drives by calling "ftp
integration300" at a command prompt and typing in the user name and password.

Does anyone know why the query may be timing out?

--
Ian H
Aug 22 '06 #1
2 10302
ftp://integration300 uses the default port (21) but your code is attempting
to use port 20. Apparently there is nothing listening to port 20, so there
you go.
Pete

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Ian Hannah" wrote:
>
I am running the following code (using VS 2005) with the appropriate
username and password and the request always timeouts:

FtpWebRequest request =
(FtpWebRequest)WebRequest.Create("ftp://integration300:20/");
request.Method = WebRequestMethods.Ftp.ListDirectory;
request.UsePassive = false;
request.Credentials = new
NetworkCredential(<user>,<password>);
request.Proxy = null;

FtpWebResponse response =
(FtpWebResponse)request.GetResponse();
response.Close();

If I perform the query "ftp://integration300" in IE then I can see all the
available drives as expected. I can also access the drives by calling "ftp
integration300" at a command prompt and typing in the user name and password.

Does anyone know why the query may be timing out?

--
Ian H
Aug 22 '06 #2

Sorry - the code should have read:

FtpWebRequest request =
(FtpWebRequest)WebRequest.Create("ftp://192.168.80.114:21/");
request.Method = WebRequestMethods.Ftp.ListDirectory;
request.UsePassive = false;
request.Credentials = new NetworkCredential("guest",null);
request.Proxy = null;

FtpWebResponse response =
(FtpWebResponse)request.GetResponse();
response.Close();

and I still get the same problem. I was trying all sorts of things out and
forgot to set the port number back to 21

--
Ian H
"Peter Bromberg [C# MVP]" wrote:
ftp://integration300 uses the default port (21) but your code is attempting
to use port 20. Apparently there is nothing listening to port 20, so there
you go.
Pete

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Ian Hannah" wrote:

I am running the following code (using VS 2005) with the appropriate
username and password and the request always timeouts:

FtpWebRequest request =
(FtpWebRequest)WebRequest.Create("ftp://integration300:20/");
request.Method = WebRequestMethods.Ftp.ListDirectory;
request.UsePassive = false;
request.Credentials = new
NetworkCredential(<user>,<password>);
request.Proxy = null;

FtpWebResponse response =
(FtpWebResponse)request.GetResponse();
response.Close();

If I perform the query "ftp://integration300" in IE then I can see all the
available drives as expected. I can also access the drives by calling "ftp
integration300" at a command prompt and typing in the user name and password.

Does anyone know why the query may be timing out?

--
Ian H
Aug 22 '06 #3

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...
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...
2
by: Ian Hannah | last post by:
If I create an MFC application in Visual Studio 6 using the following code: CInternetSession inet_session; CFtpConnection *ftp_connection; ftp_connection = inet_session.GetFtpConnection(...
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.