All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
在C#中建立复杂的、灵活的SQL查询命令
delphi高级vcl组件表头组件(THeaderControl)使用实例
Visual,Studio,2008,新功能界面_[Asp.Net教程]
关于ASP.NET页面打印技术的总结_[Asp.Net教程]
ASP.NET2.0中实现图像转换过滤效果_.net资料_编程技术
两种ASP.Net数据库连接设置和读取方法_[Asp.Net教程]
Visual C++ 6.0教程:c++数据类型之枚举
oracle,SQL性能优化_mssql学习_编程技术
开发ASP.NET,Atlas服务器端Extender控件—基本概念以及预先需求_[Asp.Net教程]
ASP.NET,主题和外观_[Asp.Net教程]
Reading number is top 10 pictures
Discharge accidentally Actresses by the breast4
Entered the goddess in the AD1
The mother was a stay-at-home children too tired took three baby suicide
怀春少女-石一伊
Green sweet joey wong young old photos exposure
世界五大海盗
Men's and women's orgasms
BingBingFan apple dew point photo gallery1
Beautiful vacuum girl1
美女和狗狗2
Download software ranking
SP4 for SQL2000
Ashlynn Video3
Desire a peach blossom
中国结婚习俗实录
Unix video tutorial20
终极变速大师Speeder3.26
传奇私服架设教程
Kung.Fu.Panda.2
软件工程思想
C#COM编程指南
aaa published in(发表于) 2013/12/11 8:29:49 Edit(编辑)
c#远程获取网页内容_.net资料_编程技术

c#远程获取网页内容_.net资料_编程技术

c#远程获取网页内容_.net资料_编程技术-你的首页-uuhomepage.com

using System;
using System.Collections.Generic;
using System.Text;
using System.Net;
using System.IO;


namespace thief
{
class Program
{
static void Main(string[] args)
{

try {
WebClient MyWebClient = new WebClient();


MyWebClient.Credentials = CredentialCache.DefaultCredentials;//获取或设置用于对向Internet资源的请求进行身份验证的网络凭据。


Byte[] pageData = MyWebClient.DownloadData("http://www.163.com");//从指定网站下载数据


string pageHtml = Encoding.Default.GetString(pageData); //如果获取网站页面采用的是GB2312,则使用这句


//string pageHtml = Encoding.UTF8.GetString(pageData); //如果获取网站页面采用的是UTF-8,则使用这句


Console.WriteLine(pageHtml);//在控制台输入获取的内容


using (StreamWriter sw = new StreamWriter("c:\\test\\ouput.html"))//将获取的内容写入文本
{
sw.Write(pageHtml);
}


Console.ReadLine(); //让控制台暂停,否则一闪而过了
}


catch(WebException webEx) {
Console.WriteLine(webEx.Message.ToString());
}
}
}
}


注:内容转自菩提树下的杨过的博客






添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.