不在线

不在线,不常在,常常在

  博客园 :: 首页 ::  :: 联系 :: 订阅 订阅 :: 管理 ::
  34 随笔 :: 2 文章 :: 249 评论 :: 0 引用

公告

2010年2月1日 #

//保证WebBrowser中的url跳转始终在WebBrowser中
            e.Cancel = true;
            
//MessageBox.Show(((WebBrowser)sender).StatusText);         
            uri = new Uri(((WebBrowser)sender).StatusText);
            
this.webBrowser1.Url = uri;        

 

posted @ 2010-02-01 15:07 不常在 阅读(221) 评论(0) 编辑

 

 1  /// <summary>
 2         /// 检测连接指定主机网络状况
 3         /// </summary>
 4         /// <param name="host">主机名:可以为IP或者一級域名</param>
 5         /// <returns>true连接正常,false无法正常连接</returns>
 6         public static bool Check(string host)
 7         {
 8             bool isOk = false;
 9             Ping ping = new Ping();
10             PingOptions options = new PingOptions();
11             options.DontFragment = true;
12             PingReply reply = null;
13             try
14             {
15                 reply = ping.Send(host);
16                 if (reply.Status == IPStatus.Success)
17                 {
18                     isOk = true;
19                 }
20                 else
21                 {
22                     isOk = false;
23                 }
24             }
25             catch(Exception exc)
26             {
27                 isOk = false;
28             }            
29             return isOk;
30         }

 

 

posted @ 2010-02-01 15:02 不常在 阅读(99) 评论(0) 编辑