WebClient not found.

I have already done a search in Qaru (and google) but cannot find a specific answer that solves my problem.

I want to read some content on the page. I tried using Webclient , but this gives me this error:

Cannot find name of type or WebClient namespace (ae you missing using directive or assembly reference?)

I tried to find on Google how to solve this error, but did not find the correct answer (I also tried HttpClient , same result).

How do I make sure that I get the contents of its specific page?

Btw, this is what I have right now:

 WebClient client = new WebClient(); // Use google as test page string downloadString = client.DownloadString("http://www.gooogle.com"); 

And I use the Visual Studio 2015 community and ASP.Net v5

+5
source share
1 answer

Make sure you have a link to System.dll in your project.

Also enable using System.Net; to the section of the usings directive of the source code, where you plan to use WebClient , or use its full name, i.e.

 var client = new System.Net.WebClient() 
+3
source

Source: https://habr.com/ru/post/1244362/


All Articles