搂住又开了个帖子??
呵呵,再帖一次:
源代码中是否有无法找到网页
http://dotnet.aspx.cc/ShowDetail.aspx?id=0A6660CE-4138-41EF-B882-15DB65564709
呵呵,再帖一次:
源代码中是否有无法找到网页
http://dotnet.aspx.cc/ShowDetail.aspx?id=0A6660CE-4138-41EF-B882-15DB65564709
解决方案 »
- FluorineFx中netConnection的Cookie的问题
- 我是新手,这段代码应该怎么写才正确
- 正则表达式
- rup流程的特点 ?
- ★★★★★ 小白请教:一段关于委托的简单代码 ★★★★★
- 关于JAVASCRIPT的问题
- Microsoft.Rtc.Sip.UnauthorizedException类型的异常,100分
- pda上启动cab包的问题
- 请问为什么csc不起作用?
- 如何让Notify实现系统热键功能?
- 向高手请教:低层问题:我想使FORM窗体在WINDOWS桌面(explorer.exe)显示时,同时运行...
- public TcpClient(AddressFamily); 谁用过?
private static string CmdPing(string strIp)
{
Process p = new Process();
p.StartInfo.FileName = "cmd.exe";
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.CreateNoWindow = true;
string pingrst;
p.Start();
p.StandardInput.WriteLine("ping -n 1 "+strIp);
p.StandardInput.WriteLine("exit");
string strRst = p.StandardOutput.ReadToEnd();
if(strRst.IndexOf("(0% loss)")!=-1)
pingrst = "连接";
else if( strRst.IndexOf("Destination host unreachable.")!=-1)
pingrst = "无法到达目的主机";
else if(strRst.IndexOf("Request timed out.")!=-1)
pingrst = "超时";
else if(strRst.IndexOf("Unknown host")!=-1)
pingrst = "无法解析主机";
else
pingrst = strRst;
p.Close();
return pingrst; }
接收收到的文字,分析里面的内容比如 是 有404错误, 就是文件没找到.
WebRequest myWebRequest=WebRequest.Create("一个无效链接的地址");
myWebRequest.Timeout=5000;
try
{
WebResponse myWebResponse=myWebRequest.GetResponse();
Stream resStream = myWebResponse.GetResponseStream();
StreamReader sr = new StreamReader(resStream, System.Text.Encoding.Default);
this.Label1.Text = sr.ReadToEnd();
resStream.Close();
sr.Close();
}
catch(System.Net.WebException xx)
{
this.Label1.Text=xx.Message;
}如果label标签显示:无效的地址404错误说明链接无效