判別網址是否存在

摘要:判別網址是否存在

   Uri urlCheck = new Uri(this.txbUrl.Text.Trim()); 
   WebRequest request = WebRequest.Create(urlCheck); 
   request.Timeout = 15000; 
   WebResponse response; 

   try
   { 
   response = request.GetResponse(); 
   Response.Write("Url存在"); 
   } 
   catch (Exception) 
   { 
 Response.Write("Url不存在"); 
   }