having problem to translate from WinForm to Windows-CE C# program - FTP transfer [modified]
-
having problem to translate from WinForm to Windows-CE C# program - FTP transfer i have this code for transfer from Local computer to FTP server its work excellent on WinForm, i must have this on Windows-CE and it dosnt work the code:
string MyFile = @"d:\PC.sdf";
string url = "ftp://127.0.0.1/PC.sdf"; FtpWebRequest request = (FtpWebRequest)FtpWebRequest.Create(url); request.Method = WebRequestMethods.Ftp.UploadFile; //request.Credentials = new NetworkCredential("user name", "password"); request.UsePassive = true; request.UseBinary = true; request.KeepAlive = false; //byte\[\] buffer = File.ReadAllBytes(MyFile); using (Stream reqStream = request.GetRequestStream()) { int count = 0; byte\[\] buffer = new byte\[100\]; using (FileStream file = new FileStream(MyFile, FileMode.Open)) { while ((count = file.Read(buffer, 0, 100)) > 0) { reqStream.Write(buffer, 0, count); } } }
in WinCE there isnt FtpWebRequest or FtpWebRequest i think that i need to use OpenNetCF ???? can i get any C# sample code for this ?
modified on Friday, August 12, 2011 6:08 AM
-
having problem to translate from WinForm to Windows-CE C# program - FTP transfer i have this code for transfer from Local computer to FTP server its work excellent on WinForm, i must have this on Windows-CE and it dosnt work the code:
string MyFile = @"d:\PC.sdf";
string url = "ftp://127.0.0.1/PC.sdf"; FtpWebRequest request = (FtpWebRequest)FtpWebRequest.Create(url); request.Method = WebRequestMethods.Ftp.UploadFile; //request.Credentials = new NetworkCredential("user name", "password"); request.UsePassive = true; request.UseBinary = true; request.KeepAlive = false; //byte\[\] buffer = File.ReadAllBytes(MyFile); using (Stream reqStream = request.GetRequestStream()) { int count = 0; byte\[\] buffer = new byte\[100\]; using (FileStream file = new FileStream(MyFile, FileMode.Open)) { while ((count = file.Read(buffer, 0, 100)) > 0) { reqStream.Write(buffer, 0, count); } } }
in WinCE there isnt FtpWebRequest or FtpWebRequest i think that i need to use OpenNetCF ???? can i get any C# sample code for this ?
modified on Friday, August 12, 2011 6:08 AM
Firstly, always use the
code block
widget when posting code samples - it preserves the formatting and makes it easier to read. (you can edit your question and add it) Secondly, "it dosnt work" isn't particularly helpful - what does it do that you didn't expect, or not do that you did? Was there an error message?Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together. Manfred R. Bihy: "Looks as if OP is learning resistant."