Home All Groups Group Topic Archive Search About

FTPWebRequest problem

Author
11 Sep 2006 1:56 PM
Sputnik
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( "Integration300",
"guest", "ihannah", 21,TRUE);

    CString CurrentDirectory;
    ftp_connection->GetCurrentDirectory(CurrentDirectory);

then the FTP connection is made and works as expected.

If I then try and use the following code (C#, Visual Studio 2005) I
always get a timeout:

      // Get the object used to communicate with the server.
      FtpWebRequest request =
(FtpWebRequest)WebRequest.Create(@"ftp://integration300");
      request.Credentials   = new NetworkCredential("guest","ihannah");
      request.Proxy = null;
      request.EnableSsl     = false;
      request.UseBinary     = true;
      request.KeepAlive     = false;
      request.Method        =
WebRequestMethods.Ftp.ListDirectoryDetails;

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

Does anyone have any idea why this is the case?

Regards

Ian Hannah

AddThis Social Bookmark Button