By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,911 Members | 1,239 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,911 IT Pros & Developers. It's quick & easy.

FTPWebRequest always timeouts

P: n/a

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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a

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.