Download a file and save it local

Updated on April 19, 2017 in [A] C# .Net
Share on Facebook0Tweet about this on TwitterShare on Google+0Share on Reddit0
1 on April 19, 2017

Hello at all!

I want to download a .txt file from a server and save it local on my computer.
I must configure the save path as well.

Google gives me this code:
webClient.DownloadFile(“https://download-link.txt”, “D:\file.txt”);

But the errormessage in Visual Studio tells me:
The name ‘webClient’ does not exist in the current context.

Anyone an idea?
Thank you!

  • Liked by
0 on April 19, 2017

Can we get a bit more context of what you’re doing?
What are you working on, what are you working in?
Is it a game with Unity?
Is it an UWP app or any other Windows 10 SDK app?
Is it an Windows 8.1 SDK app?
What is the entire script? or at least more then just one line.

As for what I can guess right now you need to actually create a variable called ‘webClient’ which you probably haven’t done yet.

  • Liked by