我怎样才能得到网页的内容并将其保存到字符串变量 [英] How I can get web page's content and save it into the string variable

查看:92
本文介绍了我怎样才能得到网页的内容并将其保存到字符串变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨伙计

我怎样才能使用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");

这篇关于我怎样才能得到网页的内容并将其保存到字符串变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆