简体   繁体   English

webclient.downloadfile检查是否未下载

[英]webclient.downloadfile check if not downloaded

I have code as follows: 我有如下代码:

client.DownloadFile(Convert.ToString(DR(1)), "c:\\images\\" & name)

I want to check if the file was actually downloaded, something like: 我想检查文件是否实际下载,类似:

If client.downloadFile = 0 then

The reason for this is that there is a stored procedure that get's all URL's from my database and then it should download them, let's say that one row does not contain a URL then it should just write to my log() that the file was not downloaded locally. 原因是存在一个存储过程,该存储过程从我的数据库中获取所有URL,然后应该下载它们,比如说一行不包含URL,那么它应该只写到我的log()文件中本地下载。

Is this possible or is there a method to use? 这可能还是有使用方法?

I don't mind C# help. 我不介意C#的帮助。

you can use below mentioned code it may help you 您可以使用下面提到的代码,它可能会帮助您

 webClient.DownloadDataAsync(myUri);
    webClient.DownloadDataCompleted += (s, e) =>
                                       {
                                        //check your condition...
                                       };

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM