请帮我解答相关问题 [英] please help me with relevant answer

查看:59
本文介绍了请帮我解答相关问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的webaplicaton正在重定向到谷歌搜索引擎..我想将页面从谷歌搜索引擎保存到我的目录..我将自动执行...

my webaplicaton is redirecting to google search engine ..i want to save pages from google search engine to my directory..how will i do it automatically...

推荐答案

您可以使用以下代码将网页内容转换为字符串:



You can use the following code to get the content of a web page into a string:

string url = "some site";
string source = string.Empty;
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
using(StreamReader sr = new StreamReader(response.GetResponseStream()){
    source = sr.ReadToEnd();
}

*您将把内容放在字符串 source



可选片段:

* You will the the content placed in the string source

Optional snippet:

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







干杯,

Edo




Cheers,
Edo


这篇关于请帮我解答相关问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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