/// <summary> /// 是否可连接特定网址 /// </summary> /// <param name="url">网址</param> /// <returns></returns> public static bool CanConnection(string url) { try { WebResponse testResponse = (HttpWebResponse)NetWorkHelp.CreateHttpWebRequest(url).GetResponse(); return(true); } catch (Exception) { return(false); } }
public static long GetUrlFileSize(string url) { //获得文件大小并返回 return(NetWorkHelp.CreateHttpWebRequest(url).GetResponse().ContentLength); }