Urgent: Issue with FtpWebRequest in OpenNETCF.Net.Ftp library.

Last post 07-11-2008 7:32 by nagarajukt. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 07-11-2008 5:10

    Urgent: Issue with FtpWebRequest in OpenNETCF.Net.Ftp library.

    Hi,

    I am using "opennetcf.net.ftp library" for uploading a file to FTP server from .net windows mobile application. I am using the following code. It is connecting to server but I am getting a error saying that'

    using OpenNETCF.Net.Ftp;

    string fileName = "sample.txt";string ip; string username; string password

    string path = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase);

    FileInfo fileInf = new FileInfo(path + "\\" + fileName);

    FtpRequestCreator creator = new FtpRequestCreator();

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

    Uri testUri;

    if (ip.IndexOf("ftp:") != 0)

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

    else

    testUri = new Uri(ip);

     

    reqFTP = (FtpWebRequest)FtpWebRequest.Create(testUri);

    //reqFTP.UseDefaultCredentials = false;

    reqFTP.Credentials = new NetworkCredential(username, password);

    FileStream fs = fileInf.OpenRead();

    while (contentLen != 0)

    {

    strm.Write(buff, 0, contentLen);

     contentLen = fs.Read(buff, 0, 2048);

    }

    strm.Close();

    fs.Close();

    Please let me know what I am missing in this code

     

    Thanks

  • 07-11-2008 7:32 In reply to

    Re: Urgent: Issue with FtpWebRequest in OpenNETCF.Net.Ftp library.

    I am getting  errror "Could not login to FTP server".

Page 1 of 1 (2 items)