我怎样才能得到网页的内容并将其保存到字符串变量

问题描述:

嗨伙计

我怎样才能使用asp.net web页面的内容?我想一个网站的HTML code存储到字符串变量我该怎么办呢?我的意思是有网站,我需要编写一个程序来获取页面,并将其存储到字符串变量。

hi folks
How I can get the content of the web page using asp.net ? I want to store html code of one web site into the string variable how I can do this ? I mean there is web site I need to write a program to get the page and store it into string variable.

您可以使用WebClient

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