how to download multiple files with httpclient/webclient using c#/too many requests - error

Viewed 24

How can i download more then 1 file, in this case i'm always get error - too many requests 429.

string[] a = File.ReadAllLines(@"C:\4.txt");
             using (HttpClient client = new HttpClient())
                 foreach (var sfile in a)
                     using (var stream = await client.GetStreamAsync(sfile))
                     using (var fileStream = File.Create(DirDialog.SelectedPath + @"\files\" + Path.GetFileName(sfile)))
                         await stream.CopyToAsync(fileStream);
0 Answers
Related