改了一下,关键是那个Encoding.Dufault。参考《Visual C# 入门与精通》Sample,调试通过。
static void Main(string[] args)
{
//WriteToFile();
myMethod();
}
static void myMethod()
{
HttpWebRequest webreq = (HttpWebRequest)WebRequest.Create("http://localhost/mail/1.html");
HttpWebResponse webresp = (HttpWebResponse)webreq.GetResponse();
StreamReader strm = new StreamReader(webresp.GetResponseStream(),Encoding.Default);
string sLine;
do
{
sLine = strm.ReadLine();
Console.WriteLine(sLine);
}while(sLine!=null);
strm.Close();
}
static void Main(string[] args)
{
//WriteToFile();
myMethod();
}
static void myMethod()
{
HttpWebRequest webreq = (HttpWebRequest)WebRequest.Create("http://localhost/mail/1.html");
HttpWebResponse webresp = (HttpWebResponse)webreq.GetResponse();
StreamReader strm = new StreamReader(webresp.GetResponseStream(),Encoding.Default);
string sLine;
do
{
sLine = strm.ReadLine();
Console.WriteLine(sLine);
}while(sLine!=null);
strm.Close();
}
解决方案 »
- 初学者新编的C#计算器代码,另外KeyPress事件想不到该怎么简单的实现,求助...
- c# listview 内容自动换行
- (140分) 面向对象方法学关于C#入门基础概念的几个小问题 抢答送分 很简单 明天结贴
- 求框架的解决方案
- 求C#代码
- .net2.0bata 对以前的版本程序支持怎样?
- 有什么方法突破限制访问类中的private成员?
- 启动一个dialog,后面是一个await 方法传送数据,但dialog在数据传送完之前没有显示
- 如何用winform c#来关闭本地连接?
- 怎样在C#中给函数使用默认的参数?
- 请教高手!怎样在c#中调用COM组件,调用在ASP中类似... ...
- 大家来帮我看一下
内容一般,不算深入,还可以看。