1

嗨,我有以下代码:

ftpRequest = (FtpWebRequest)WebRequest.Create(host + remoteFile);
            /* Log in to the FTP Server with the User Name and Password Provided */
            if (withDomain)
            {
                ftpRequest.Credentials = new NetworkCredential(user.Normalize(), pass.Normalize(), dom.Normalize());
            }
            else
            {
                ftpRequest.Credentials = new NetworkCredential(user.Normalize(), pass.Normalize());
            }

            ftpRequest.UseBinary = true;
            ftpRequest.UsePassive = true;
            ftpRequest.KeepAlive = true;

            ftpRequest.Method = WebRequestMethods.Ftp.UploadFile;
            /* Establish Return Communication with the FTP Server */
            ftpStream = ftpRequest.GetRequestStream();

仅当未提供域时,我才会收到错误,即在仅提供用户名和密码的情况下,我会收到错误。但是,相同的用户名和密码可以在 Dreamweaver 或其他 FTP 客户端工具上正常工作。

4

0 回答 0