使用sharpftpserver.dll​通过c#语句打开ftp服务private FtpServer ftpServer = new FtpServer();ftpServer.start();之后在cmd中键入命令ftpopen ip地址按提示 输入用户名密码(这个可以保证是正确的)但是就是提示密码错误 然后直接在网页中键入ftp://用户名:密码@ip地址就出现一个对话框提示:要登录到该ftp服务器,请键入用户名和密码请问该怎么解决?FTPC#

解决方案 »

  1.   

    说明你的sharpftpserver配置有问题
      

  2.   

    看起来project不怎么火啊,自己下载代码来调试下吧.
      

  3.   

    把你的用户名和密码贴出来,“ftp://用户名:密码@ip地址”的形式是不允许出现特殊字符的,例如:“、@”等字符
      

  4.   

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using SharpFtpServer;
    using System.Threading;
    using System.Net;namespace svn_update
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();            if (!System.IO.Directory.Exists(System.Windows.Forms.Application.StartupPath + @"\FtpConfig\"))
                {
                    System.IO.Directory.CreateDirectory(System.Windows.Forms.Application.StartupPath + @"\FtpConfig\");
                }
                if (!System.IO.Directory.Exists(System.Windows.Forms.Application.StartupPath + @"\Version\"))
                {
                    System.IO.Directory.CreateDirectory(System.Windows.Forms.Application.StartupPath + @"\Version\");
                }            FtpAuth.FtpAuthFilePath = System.Windows.Forms.Application.StartupPath + @"\FtpConfig\account.xml";            FtpAuthArgs account = new FtpAuthArgs("aa", "aa", System.Windows.Forms.Application.StartupPath + @"\Version");
                FtpAuth.AddAccount(account);
                FtpAuth.SaveAccount();
               
            }        private void button1_Click(object sender, EventArgs e)
            {
                update = new ClsUpdate();            TupgradeTask task=new TupgradeTask();
                updateTable table = new updateTable();
              //  /*测试
                task.TFTPIP = "192.168.33.44";//任意Ip
                task.TFTPPORT = "21";
                task.LoginUser = "aa";
                task.LoginPassword = "aa";
                task.UpgFileName = "aa";
             //   */            if (!(string.IsNullOrEmpty(textFileName.Text)&&string.IsNullOrEmpty(textIP.Text)&&string.IsNullOrEmpty(textPort.Text)
                    &&string.IsNullOrEmpty(textUser.Text)&&string.IsNullOrEmpty(textPw.Text))&&flag)
                {
                    //task.TFTPIP = textIP.Text;
                    //task.TFTPPORT = textPort.Text;
                    //task.LoginUser = textUser.Text;
                    //task.LoginPassword = textPw.Text;
                    //task.UpgFileName = textFileName.Text;                update.getInfo(task, table);
                    if (update.updateMaster())
                    {
                        MessageBox.Show("升级成功", "提示");
                    }
                    else
                    {
                        MessageBox.Show("升级失败", "提示");
                    }
                }
                else
                {
                    MessageBox.Show("数据不完整或文件缺失");
                }
            }       // /*  以下发生错误  输入ftp密码错误无法连接上ftp 
            private void Form1_Load(object sender, EventArgs e)
            {
                this.FormClosing += new FormClosingEventHandler(Form1_FormClosing);
                string ftpPath = Application.StartupPath + "\\" + "Version\\";//后面加斜杆
                if (!System.IO.Directory.Exists(ftpPath))
                {
                    MessageBox.Show("tftpd32.exe文件缺失");
                    flag = false;
                }
                else
                {                ftpServer.Start();
                    startTftpProgram(ftpPath);
                }
            }
            void Form1_FormClosing(object sender, FormClosingEventArgs e)
            {
                ftpServer.Stop();
            }
            private void startTftpProgram(string ftpPath)
            {
                //运行tftpd32.exe
                p = new System.Diagnostics.Process();
                //文件夹路径
                p.StartInfo.WorkingDirectory = ftpPath;
                //运行程序名
                p.StartInfo.FileName = ftpPath+"Tftpd32";//完整地址且不加扩展名
                p.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
                p.StartInfo.Arguments = "";
                if (!p.Start())
                {
                    MessageBox.Show("Tftpd32.exe运行失败");
                }
            }
           // */        private delegate void showState();
            private FtpServer ftpServer = new FtpServer();
            private Boolean flag = true;
            private System.Diagnostics.Process p;
            ClsUpdate update = null;
        }
    }