URLDownload를 사용하여 파일을 다운로드하고 5 개의 파일 (zip)을 다운로드하고 그 중 2 개가 손상되었으며 첫 번째 파일을 다시 다운로드 (2-3 회)하려고 시도하고 두 번째로 작동합니다 한 20 (시간) stiil dameged 후, 그것은 그것이 끝나기 전에 다운로드를 중지하는 것 같습니다.URLDownloadToFile 파일의 반을 다운로드 중
손상된(내가 수동으로이 파일을 다운로드 및 오픈 벌금 및 크기 75킬로바이트, 당신은 차이를 볼하고 전체 다운로드 \ 손상되지 것을 알고 뿌리 11킬로바이트 한 내가 URLDownload에서 다운로드 한 파일을 압축)
내 코드
[DllImport("urlmon.dll", CharSet = CharSet.Auto, SetLastError = true)]
static extern Int32 URLDownloadToFile(Int32 pCaller, string szURL, string szFileName, Int32 dwReserved, Int32 lpfnCB);
int response = URLDownloadToFile(0, Link, FilePath, 0, 0);
if (response == 0)
{
lsUtils.WriteToLog("File " + FileName + " downloaded.", true);
int zipTry = 10;
if (!isValidZip(FilePath))
{
clsUtils.WriteToLog("Attempting to re-download damaged file " + FileName, true);
while (!isValidZip(FilePath) && zipTry > 1)
{
clsUtils.WriteToLog("File " + FileName + " Zip file damaged.", true);
response = URLDownloadToFile(0, Link, FilePath, 0, 0);
zipTry--;
}
}
WebClient를 사용하지 않는 이유는 무엇입니까? 이 파일 – Ksv3n
은 로그인/암호 후 은행 사이트에, 난 그냥 URL을 삽입하고이 파일을 다운로드 할 수 있습니다. 내가 4.0을 사용하고 – user3567884