download - 安全 FTP 下载在 UWP 中不起作用
问题描述
我尝试使用 BackgroundDownloader 类从安全的 FTP 服务器下载文件,但它没有下载,也没有抛出任何异常。
下面的 GetResponseInformation() 返回 null。
我提供如下输入 URL: ftp://username:password@hostIP/test.pdf
下面的代码:
Uri uri = new Uri(ftpUrlBox.Text.Trim());
StorageFile storageFile = await pickedFolder.CreateFileAsync("DownloadedFile.pdf", CreationCollisionOption.ReplaceExisting);
BackgroundDownloader backgroundDownloader = new BackgroundDownloader();
DownloadOperation downloadOperation = backgroundDownloader.CreateDownload(uri, storageFile);
ftpBar.Visibility = Visibility.Visible;
await downloadOperation.StartAsync();
ftpBar.Visibility = Visibility.Collapsed;
ResponseInformation responseInformation = downloadOperation.GetResponseInformation();
ftpStatusText.Text = responseInformation != null ? responseInformation.StatusCode.ToString() : string.Empty;
请帮助如何从 UWP 中的安全 FTP 服务器下载和上传。
注意:如果我使用一些 3rd 方 nuget 库,则 FTP(S) 下载工作正常。但不适用于上述 UWP 代码。
解决方案
推荐阅读
- google-sheets - 谷歌表格中的多个用户的数据输入表单在同时访问时不起作用
- python - scikit-learn - LinearRegression() 可以使用一个特征学习与直线不同的东西吗?
- javascript - nodejs - 无法使用代理服务器拦截应用程序流量
- reactjs - 即使在提交数据后,React hooks 表单也不会重置文本字段
- laravel - Laravel 第一次加载速度慢
- java - 通过使用 Properties 的子类来覆盖 getProperty() 方法,尝试在另一个属性键中使用另一个属性键值
- android - 从 webview 下载文件
- javascript - 鼠标到达末尾时自动滚动导航栏列表
- python - 无法训练 rasa 聊天机器人,因为它显示张量流错误
- vue.js - 在特定索引处从 Vuex 获取对象