c# - 如何在UWP中创建FTP连接?

标签 c# ftp win-universal-app universal

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

Only 'http' and 'https' schemes are allowed.

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# - 如何在UWP中创建FTP连接?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36988039/

相关文章:

c# - 如何在 OnNavigatingFromAsync 中显示模态对话框并取消导航

c# - Entity Framework 5 SaveChanges() 不回滚尝试的事务

c# - 有效地将超过 180 亿个输入值映射到几个输出值

C# 在使用 MemoryStream 类时尝试替换字节

azure - 在虚拟机 VM 上安装 FTP 应用程序 FileZilla Server 并使用 FTP 发布

javascript - 如何使用nodejs中的multer将我的文件上传到另一台服务器?

linux - FTP "ls -lt"命令 : How does it list the file details for Linux FTP and Windows FTP server?

c# - 在 W10 通用应用程序中播放 Assets 文件夹中的音频

c# - Flyout 的 "Light Dismissal"导致需要点击 2 次才能打开下一个 Flyout

c# - Java 中 C# 格式字符串 cout 的等效语句