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