请问下各位大神,用C#如何通过一个地址抓取页面内容以及样式,保存为一个静态页面,例如抓这个页面http://www.baidu.com/s?wd=%E6%B5%B7%E6%B4%8B&rsv_spt=1&issp=1&rsv_bp=0&ie=utf-8&tn=baiduhome_pg&rsv_n=2&rsv_sug3=1&rsv_sug=0&rsv_sug1=1&rsv_sug4=62 原封不动的抓取下来,保存成一个静态页面,分有点少请见谅C#asp.net
解决方案 »
- 关于C#重写与覆写的疑问
- C# 发生了 System.AccessViolationException
- 一个没解决的问题:关于继承的datagridview控件,高手进来看看
- 如何存放dll文件在子目录下
- 改变窗体大小时抖动的很厉害有办法解决吗?
- 为什么我用文件流读取文件只能读取 40k的文件。。。再大的文件就不好使了。。。为什么呢
- 在流数据中, 如何读取出SSL数据
- 如何处理读取Session未赋值变量所引起的错误
- 怎么把double型的转为string型??
- 这是为什么?我是在本机使用的,当我对一个文件进行打开操作时发生错误?
- 用OleDb方式连接excel,无法删除默认sheet的问题
- 如何将一台打印机的任务转移到另一台打印机进行打印
// If required by the server, set the credentials.
request.Credentials = CredentialCache.DefaultCredentials;
// Get the response.
HttpWebResponse response = (HttpWebResponse)request.GetResponse ();
// Display the status.
Console.WriteLine (response.StatusDescription);
// Get the stream containing content returned by the server.
Stream dataStream = response.GetResponseStream ();
// Open the stream using a StreamReader for easy access.
StreamReader reader = new StreamReader (dataStream);
// Read the content.
string responseFromServer = reader.ReadToEnd ();
// Display the content.
Console.WriteLine (responseFromServer);
// Cleanup the streams and the response.
reader.Close ();
dataStream.Close ();
response.Close ();
参考http://www.cnblogs.com/loveyakamoz/archive/2011/07/27/2118937.html