【发布时间】:2020-10-17 16:56:51
【问题描述】:
我正在使用C# Webclient下载一个图片,但是有一个问题,因为图片是0 kb。
在此过程中我没有收到错误消息。
有人可以帮我吗?
谢谢
private static void Download(string _caminhoArquivo, string _nomeArquivo)
{
try
{
using (WebClient client = new WebClient())
{
string _arquivodownl = "C:\\Img\\ImagensMensagens\\" + _nomeArquivo;
string url = "https://p2.trrsf.com/image/fget/cf/940/0/images.terra.com/2020/10/16/2020-10-16T140412Z_1_LYNXMPEG9F1AV_RTROPTP_4_BRAZIL-POLITICS.JPG";
client.DownloadFileAsync(new Uri(url), _arquivodownl);
}
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
}
【问题讨论】: