Compact Framework 2.0 & FTP

Is there a way to transfer files from a Pocket PC (Windows Mobile 5.0) to an FTP server   I thought FTP functionality was available in system.net.webclient (I read this from another post), but I don't seem to have a webclient class (Compact Framework 2.0).

Any help would be much appreciated.




Answer this question

Compact Framework 2.0 & FTP

  • Fallen Ghost

    FTP Classes are not available in .NET CF 1.0 or 2.0.  You can use the OpenNETCF SDF FTP Class.  Check here for more details
    http://www.opennetcf.org/library/OpenNETCF.Net.Ftp.html

  • kumarsv

    I do not have VS 2003 installed, only 2005 B2 and OpenNetCF 1.4 will not install for me (I get an invalid object reference error on the install).  So, I am guessing that it is not compatible with VS 2005 B2 and Compact Framework version 2.0...   I would like to know for sure if anyone else has more input.
  • Litey

    Charlie,

    Can I ask if you ever got to the bottom of the Ftp.FtpWebRequest.CreateDefault Not Supported problem. I am running Visual Studio 2005 with the OpenNetCF libriaries and get the same problem you experienced.

    Many thanks


  • the user

    Is this compatible with VS 2005 B2 and CF 2.0
    I downloaded and installed the OpenNETCF stuff (it installed into VS .Net 2003 CF 1.0.500).
    I put a ref to the OpenNETCF.Net class (from the older VS install) into my VS 2005 B2 Windows Mobile 5 Pocket PC project and utilized the FtpWebRequest.  It compiled and deployed ok, but when I debug it using an emulator it generates a "Not supported Exception".
    Am I not referencing it correctly... is it not compatible with the beta rel stuff, or   (I'm about a 3-4 on a scale of 1-10 with VB, so I could be doing something basically wrong and not know it)

    Here is an example of what I did... (the error is generated from the first line)

    Dim
    wr As FtpWebRequest = FtpWebRequest.CreateDefault(New Uri("ftp://xxx.com/file.txt"))

    Dim ts As String = "Some sample text."

    Dim enc As New System.Text.ASCIIEncoding

    Dim bytes As Byte() = enc.GetBytes(ts)

    Dim ns As Stream = wr.GetRequestStream()

    wr.ContentLength = bytes.Length()

    ns.Write(bytes, 0, bytes.Length())

    ns.Close()

    Thanks 1E6 for your help.



  • mshafiq

    I had the same problem :"Not supported Exception".

    Here, it's the solution to connect on a FTP server from Windows Mobile 5.0 using OpenNETCF: (C#)

    using OpenNETCF.Net.Ftp;

    using System.Net;

    private static FtpWebRequest request;

    private static Stream ftpRequestStream;

    private static void Connect()

    {

    FtpRequestCreator creator = new FtpRequestCreator();

    WebRequest.RegisterPrefix("ftp:", creator);

    // Building our URI object

    Uri testUri;

    if ("192.168.1.9:2121".IndexOf("ftp:") != 0)

    testUri = new Uri("ftp://" + "192.168.1.9:21");

    else

    testUri = new Uri("192.168.1.9:21");

    // Creating a new FtbRequest object

    request = (FtpWebRequest)WebRequest.Create(testUri);

    request.Credentials = new NetworkCredential("login", "password");

    // Getting the Request stream

    ftpRequestStream = request.GetRequestStream();

    StreamReader reader = new StreamReader(ftpRequestStream);

    ...

    ...

    }

    If you don't write:

    FtpRequestCreator creator = new FtpRequestCreator();

    WebRequest.RegisterPrefix("ftp:", creator);

    you have the "Not supported Exception" error.


  • Makler

    We've just released edtFTPnet/Compact, an FTP client for the .NET Compact Framework.

    edtFTPnet/Compact is a port of edtFTPnet, the popular .NET library for embedding full FTP capabilities into .NET applications.

    It includes
    • a rich interface supporting many FTP commands
    • active and passive mode support.
    • resuming of binary transfers.
    • events for monitoring progress of data transfers.
    • compiled for .NET Compact Framework 1.0 and above.
    • full source code included.
    See

    http://www.enterprisedt.com/products/edtftpnetcompact/overview.html

    for more details.

  • Compact Framework 2.0 & FTP