How to download large file (>300mb) via .net core 3.1 API?

Dicky Lau 21 Reputation points
2021-03-30T07:51:59.297+00:00

Dear Sir/madam,

I would like to create a API endpoint for downloading large file (>300mb). How can I download a large file (>300mb) using .net core 3.1 c#?

Thanks & Regards,
Dicky

Developer technologies | .NET | Other
0 comments No comments
{count} votes

Accepted answer
  1. Castorix31 90,686 Reputation points
    2021-03-30T08:36:19.593+00:00

    This test with a 512 MB file works for me in .Net Core 3.1 =>

    At begining :

    using System.Net;
    

    Then :

            using (WebClient wc = new WebClient())
            {
                wc.Headers.Add("User-Agent: Test");
                wc.DownloadFile("http://ipv4.download.thinkbroadband.com/512MB.zip", "e:\\512MB.zip");
            } 
    

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.