微软的MSDN里面就有,详情见 .NET Framework 类库 HttpStatusCode 枚举
解决方案 »
- 一个关于Datetime的问题
- CLASS缺失问题
- 关于.net ComboBox控件的问题
- 在Web程序中如何用System.Window.Forms.Clipboard类?
- 做WinForm时遇到的怪事
- 谁有没有做好的关于用C#操作Excel的小程序,win桌面应用程序,急学习....
- 请教C#类似于VS的查找功能
- winform的线程的问题。
- 关于CrystalReport的问题
- datalist分页显示问题已经解决,中午放全部源码,但如何通过后台进行付值尚未解决,请求大家帮忙。
- 菜鸟跪求,高分问题:初学c#,怎么用它坐一个栈的算法!十分感谢~~~
- [在线等待]用C#怎样读取服务器的信息(如硬盘大小,操作系统等)
// Sends the HttpWebRequest and waits for the response.
try
{
HttpWebResponse myHttpWebResponse = (HttpWebResponse)myHttpWebRequest.GetResponse();
Stream receiveStream = myHttpWebResponse.GetResponseStream();
Encoding encode = System.Text.Encoding.GetEncoding("utf-8");
// Pipes the stream to a higher level stream reader with the required encoding format.
StreamReader readStream = new StreamReader( receiveStream, encode );
this.richTextBox1.Text+="\r\nResponse stream received.";
Char[] read = new Char[256];
// Reads 256 characters at a time.
int count = readStream.Read( read, 0, 256 );
this.richTextBox1.Text+="HTML...\r\n";
while (count > 0)
{
// Dumps the 256 characters on a string and displays the string to the console.
String str = new String(read, 0, count);
this.richTextBox1.Text+=str;
count = readStream.Read(read, 0, 256);
}
// Releases the resources of the response.
myHttpWebResponse.Close();
// Releases the resources of the Stream.
readStream.Close();
}
catch(System.Net.WebException aa)
{
this.richTextBox1.Text+=aa.Message; }
// Gets the stream associated with the response.
这样的代码只会显示500错误
catch(System.Net.WebException aa)
{
this.richTextBox1.Text+=aa.Message;
}
这个只显示内部服务器599错误而不是显示关闭了HTTP友好信息的
ADODB.Field error '800a0bcd' Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record. /detail/detail.asp, line 10
参考--
利用HttpRequest登录到某个网站,然后获取网站信息的程序示例:
http://news.dvbbs.net/infoview/Article_2776.html
利用CookieContainer类实现
我的意思是
HttpWebRequest myHttpWebRequest = (HttpWebRequest)WebRequest.Create("http://www.donghualvyou.com/detail/detail.asp?id=751");
try
{
HttpWebResponse myHttpWebResponse = (HttpWebResponse)myHttpWebRequest.GetResponse();
Stream receiveStream = myHttpWebResponse.GetResponseStream();
Encoding encode = System.Text.Encoding.GetEncoding("GB18030");
StreamReader readStream = new StreamReader( receiveStream, encode );
this.richTextBox1.Text=readStream.ReadToEnd();
myHttpWebResponse.Close();
readStream.Close();
}
catch(System.Net.WebException aa)
{
this.richTextBox1.Text=aa.Message;
}
这段代码在显示正确的时候能够显示源代码但是500错误的时候只是显示500错误也就是HTTPP友好错误信息,我怎么能得到实际得错误信息,也就是关闭了HTTP友好错误信息时候的东西呢
比如ADODB.Field error '800a0bcd' Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record. /detail/detail.asp, line 10