How I can get web page's content and save it into the string variable

kamiar3001 picture kamiar3001 · Dec 22, 2010 · Viewed 168.4k times · Source

How I can get the content of the web page using ASP.NET? I need to write a program to get the HTML of a webpage and store it into a string variable.

Answer

dhinesh picture dhinesh · Dec 22, 2010

You can use the WebClient

WebClient client = new WebClient();
string downloadString = client.DownloadString("http://www.gooogle.com");