1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
using System; using System.Collections.Generic; using System.Text; using System.Net; using System.Reflection; using System.Windows.Forms; public bool isWebEnable(string strURL) { try { Uri siteUri = new Uri(strURL); WebRequest wr = WebRequest.Create(siteUri); wr.Timeout = 10000; WebResponse myResponse = wr.GetResponse(); myResponse.Close(); return true; } catch (WebException ex) { string ERRMSG = ex.Message + "\r\n\r\n URL:" + strURL; MessageBox.Show(ERRMSG, "WEB接続エラー" , MessageBoxButtons.OK, MessageBoxIcon.Warning); return false; } catch (Exception ex) { throw ex; } } |
コメント