【问题标题】:Could not found FtpWebRequest in windows phone在 windows phone 中找不到 FtpWebRequest
【发布时间】:2013-07-24 21:10:44
【问题描述】:

我正在使用 FTP

将一个 XML 文件上传到网络服务器
IsolatedStorageFile myIsolatedStorage = IsolatedStorageFile.GetUserStoreForApplication();
            using (IsolatedStorageFileStream isoStream = new IsolatedStorageFileStream("test.xml", FileMode.Append, myIsolatedStorage))
            {
                FtpWebRequest reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri"ftp://" + IPServer + "/" + isoStream.Name));
                reqFTP.UsePassive = true;
                reqFTP.UseBinary = true;
                reqFTP.Credentials = new NetworkCredential("uname", "pass");
                reqFTP.Method = WebRequestMethods.Ftp.UploadFile;


                int bufferLength = 2048;
                byte[] buffer = new byte[bufferLength];

                Stream uploadStream = reqFTP.GetRequestStream();
                int contentLength = isoStream.Read(buffer, 0, bufferLength);

                while (contentLength != 0)
                {
                    uploadStream.Write(buffer, 0, bufferLength);
                    contentLength = isoStream.Read(buffer, 0, bufferLength);
                }
            }

但我找不到 FtpWebRequest。我还添加了程序集 System.Net。我没有得到什么问题?谁能帮我解决这个问题?我可以在 windows phone 中使用 FtpWebRequest 上传文件吗?我的代码是否正确上传文件?

【问题讨论】:

    标签: c# windows-phone-7 windows-phone-8 isolatedstorage ftpwebrequest


    【解决方案1】:

    目前在 Windows Phone 中没有FtpWebRequest

    elsewhere 提出的同一个问题导致人们提到使用在 HTTP 中包装 FTP 调用的服务。除非您找到要使用的第三方组件,否则这似乎是您目前唯一的选择。

    【讨论】:

    • 嘿蒂姆,谢谢你的回复。那么如何在 ftp 服务器上上传文件呢?
    • 我用更多信息编辑了我的答案。抱歉,我没有太多帮助。只是现在似乎不太容易。
    • 好的,我会尝试使用 HTTP
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-04-06
    • 1970-01-01
    相关资源
    最近更新 更多