这是什么原因呢?急呀!

解决方案 »

  1.   

    声明
    #region Exernal Functions
     [DllImport("FtpDLL.dll", SetLastError=true, CharSet=System.Runtime.InteropServices.CharSet.Ansi)]
     private unsafe static extern string NewGetMessage();  [DllImport("FtpDLL.dll", SetLastError=true, CharSet=System.Runtime.InteropServices.CharSet.Ansi)]
     private unsafe static extern bool NewSetWorkDirectory(string strFile);  [DllImport("FtpDLL.dll", SetLastError=true, CharSet=System.Runtime.InteropServices.CharSet.Ansi)]
     private unsafe static extern void NewLogOffServer();  [DllImport("FtpDLL.dll", SetLastError=true, CharSet=System.Runtime.InteropServices.CharSet.Ansi)]
     private unsafe static extern bool NewDelFile(string strFliePath);  [DllImport("FtpDLL.dll", SetLastError=true, CharSet=System.Runtime.InteropServices.CharSet.Ansi)]
     private unsafe static extern bool NewMoveFile(
     string strRemoteFile,
     string strLocalFile,
     bool bPasv,
     bool bGet
     );  [DllImport("FtpDLL.dll", SetLastError=true, CharSet=System.Runtime.InteropServices.CharSet.Ansi)]
     private unsafe static extern bool NewLogOnToServer(
     StringBuilder hostname,
     int hostport,
     string username,
     string password,
     string acct,
     string fwhost,
     string fwusername,
     string fwpassword,
     int fwport,
     int logontype
     );
     #endregion 调用
    try
     {
     StringBuilder strHost = new StringBuilder(remoteHost, 256);  if(!NewLogOnToServer(
     strHost,
     Convert.ToInt32(remotePort),
     remoteUse,
     remotePas,
     "",
     "",
     "",
     "",
     Convert.ToInt32(remotePort),
     0
     )) 
     {
     throw new Exception("不能连接ftp服务器:" + remoteHost + "\n");
     }  if(NewSetWorkDirectory("\\" + remotePath + "\\"))
     {
     NewMoveFile(remotefile,localfile,false,false); //upload
     }

     NewLogOffServer();
     }
     catch (Exception ex)
     {
     throw new Exception(ex.Message);
     }
      

  2.   

    StringBuilder strHost = new StringBuilder(remoteHost, 256);
    ===============================
    remoteHost ???