惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

P
Proofpoint News Feed
Blog — PlanetScale
Blog — PlanetScale
GbyAI
GbyAI
C
Check Point Blog
腾讯CDC
Stack Overflow Blog
Stack Overflow Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
The GitHub Blog
The GitHub Blog
A
About on SuperTechFans
Recent Announcements
Recent Announcements
L
LangChain Blog
Microsoft Azure Blog
Microsoft Azure Blog
小众软件
小众软件
J
Java Code Geeks
博客园_首页
Jina AI
Jina AI
美团技术团队
H
Help Net Security
MyScale Blog
MyScale Blog
Engineering at Meta
Engineering at Meta
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
人人都是产品经理
人人都是产品经理
Y
Y Combinator Blog
S
SegmentFault 最新的问题

博客园 - 吴尔平

gtest 的彩色信息输出 + boost.test 的内存泄漏检测及定位 在低版本的 vc 中使用 vc 10.0 的新特性 使用另一个blog: http://blog.csdn.net/WuErPing scons + swig 如何在 vista 使用 Device Emulator 连接internet vc9 Feature Pack Beta tr1 的一些问题 NSIS Kill Process (转贴) py2exe 转换 pytetris - 吴尔平 关于模板化的friend class C# 的 random shuffle python 读取 windows event log 的简短代码 IronPython 1.0 Release Candidate (转贴 ( 据说比c实现的快1.5!) ) Visual Studio Service Pack (转贴) The 16th Annual Jolt Product Excellence Award Winners (转贴) C++/CLI FAQ (逐步整理中) C++/CLI singleton模式 (双重检测锁实现) 如何在 VS2005 的 Team Unit Testing frameworks 中测试 Native Code (C++ ) 2005 CRT memory leaks 改变 SQL Server 2000 所有对象的所有者
C#与一个彩票页面 - 吴尔平 - 博客园
吴尔平 · 2008-03-08 · via 博客园 - 吴尔平

http://www.zhcw.com/lottery/db_table_1_desc.htm 是中彩网的一个普通页面,不过这个页面要正确的下载并显示却很有点意思,下面是代码

HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://www.zhcw.com/lottery/db_table_1_desc.htm");
HttpWebResponse response 
= (HttpWebResponse)request.GetResponse();
String characterSet 
= response.CharacterSet;
if (characterSet == "ISO-8859-1"// 注意字符集
{
    characterSet 
= "gb2312";
}
Stream stream;
if (response.ContentEncoding == "gzip"// 注意内容编码
{
    stream 
= new GZipStream(response.GetResponseStream(), CompressionMode.Decompress);
}
else
{
    stream 
= response.GetResponseStream();
}
using (StreamReader reader = new StreamReader(stream, Encoding.GetEncoding(characterSet)))
{
    Console.Write(reader.ReadToEnd()); 
// OK了
}
response.Close();