none
FTP下载的地址解析错误 RRS feed

答案

全部回复

  • 能把能够下载的地址也发来么

     

     

    ftp 550  

     

    no permission

     

     

    没有权限  你还得检查下安全设置

     

    2009年1月16日 7:34
  •              string fileurl = "ftp://192.168.1.3/../../bcsy/prog/FB0100OO.BSY";
                  MessageBox.Show(fileurl);
                    try
                    {
                        ftpWBR = (FtpWebRequest)WebRequest.Create(new Uri(fileurl));
                        ftpWBR.Credentials = new NetworkCredential("abc", "abc");

                        ftpWBR.Method = WebRequestMethods.Ftp.ListDirectoryDetails;
                        ftpWBR.UseBinary = true;
                        FtpWebResponse listResponse = (FtpWebResponse)ftpWBR.GetResponse();
                        MessageBox.Show(listResponse.WelcomeMessage);

                    }
                    catch(Exception e)
                    {
                        MessageBox.Show(e.Message);
                    }
                    FtpWPS = (FtpWebResponse)ftpWBR.GetResponse();
                    MessageBox.Show(FtpWPS.WelcomeMessage);
                    instream = FtpWPS.GetResponseStream();
                    if (instream == null)
                    {
                        MessageBox.Show("查无此文件!");
                    }
                    else
                    {
                        MessageBox.Show("找到文件正在下载!");
                        Byte[] bytearray = new Byte[4096];
                        outstream = File.OpenWrite(@"D:\FB0100OO.BSY");
                        int tempflag = 0;
                        while ((tempflag = instream.Read(bytearray, 0, 4096)) > 0)
                        {
                            outstream.Write(bytearray, 0, tempflag);
                        }
                        MessageBox.Show("下载完成!");
                    }

     

    这是我的测试代码
    2009年1月16日 7:41
  •  

    解决了,地址改成

    ftp://192.168.1.2/.../..//bcsy//prog//FB0100OO.BSY 

    就解决了。这是什么原因呢?
    2009年1月16日 7:44
  • 你好!
       可能是因为你的地址写的不正确导致的。
    2009年1月16日 8:57
    版主