469,927 Members | 1,490 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,927 developers. It's quick & easy.

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 9911
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Kevin Spencer | last post: by
7 posts views Thread by jose.lopes.cruz | last post: by
2 posts views Thread by Ian Hannah | last post: by
reply views Thread by Buddy Home | last post: by
6 posts views Thread by William LaMartin | last post: by
9 posts views Thread by Waldy | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.