• asp.net如何判断网址能否打开


    private void StatusDescription_Click(object sender, System.EventArgs e)
           {
               PageUrl = UrlText.Text;
               try 
               {   
                   HttpWebRequest myHttpWebRequest = (HttpWebRequest)WebRequest.Create(PageUrl); 
                   myHttpWebRequest.Credentials = CredentialCache.DefaultCredentials;
                   HttpWebResponse myHttpWebResponse = (HttpWebResponse)myHttpWebRequest.GetResponse(); 
                   if (myHttpWebResponse.StatusCode == HttpStatusCode.OK)
                   {
                       ContentHtml.Text = "Response Status Code is OK and StatusDescription is: "+myHttpWebResponse.StatusDescription;
                   }
                   myHttpWebResponse.Close(); 
           
               } 
               catch(WebException ee) 
               {
                   ContentHtml.Text = "WebException Raised. The following error occured : "+ee.Status; 
               }
               catch(Exception ee)
               {
                   ContentHtml.Text = "The following Exception was raised : "+ee.Message;
               }
           }

  • 相关阅读:
    I2S波形解析
    F407整点原子I2C波形解码
    WAVE格式文件说明
    ADC结构体初始化成员
    这次,我是真的想吐槽MDK
    I2S源程序(正点原子F407探索者)
    强制类型转换
    嵌套结构体的初始化
    lua 元方法 __index
    lua pairs 与 ipairs
  • 原文地址:https://www.cnblogs.com/sunny-539/p/3571944.html
Copyright © 2020-2023  润新知