【问题标题】:How to create FTP connection in UWP?如何在 UWP 中创建 FTP 连接?
【发布时间】:2016-08-27 13:10:07
【问题描述】:

我想写一个简单的 FTP 客户端 UWP 程序,但是当我创建 WebResponse 时它会抛出异常:

只允许使用“http”和“https”方案。

private async void ListDirectory()
    {
        var obj = App.Current as App;

        WebRequest request = WebRequest.Create(obj.ServerUri);
        if (obj.credential != null)
        {
            request.Credentials = obj.credential;
        }

        request.Method = "LIST";

        using (WebResponse response = await request.GetResponseAsync()) // the exception is here
        {
            using (Stream responseStream = response.GetResponseStream())
            {
                using (StreamReader reader = new StreamReader(responseStream))
                {
                    string item = reader.ReadLine();
                    // add to list etc...
                }
            }
        }
    }

我在互联网上搜索后发现我必须启用 SSL,但我在 Visual Studio 2015 中找不到此选项。

【问题讨论】:

标签: c# ftp win-universal-app universal


【解决方案1】:

【讨论】:

  • 如果有人对此感到困惑:试试github.com/kiewic/FtpClient,它最终帮助了我的Windows 10。(如果你无法在VS中打开项目,只需从中获取两个相关的类。)
猜你喜欢
  • 1970-01-01
  • 2018-04-27
  • 1970-01-01
  • 2019-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多