gpt4 book ai didi

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

转载 作者:太空宇宙 更新时间:2023-11-03 12:46:51 25 4
gpt4 key购买 nike

我想编写一个简单的 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com