I am trying to work with WebClient but it is giving me errors so I check in several forums (included this one) and they where telling to put
In the top of the file:
using System.Net
And after where I want use the WebClient:
WebClient webClient = new WebClient();
webClient.DownloadFile ("http://mysite.com/myfile.txt", @"c:\myfile.txt");
And I get this error:
The type or namespace name 'WebClient' could not be found (are you missing a using directive or an assembly reference?)
In the other forums the code that I just wrote above seems to be the solution but is not working for me.
Given your tags, it sounds like you may be building a Windows Store app - in which case you need to use HttpClient
instead of WebClient
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With