public bool RemoteFileExists(string fileUrl) { bool result = false;//下载结果 WebResponse response = null; try { WebRequest req = WebRequest.Create(fileUrl); response = req.GetResponse(); if (response.ContentType == "image/jpeg") result = true; else result = false; } catch (Exception ex) { result = false; } finally { if (response != null) { response.Close(); } } return result; }
public bool RemoteFileExists(string fileUrl) { bool result = false;//下载结果
WebResponse response = null; try { WebRequest req = WebRequest.Create(fileUrl);
response = req.GetResponse(); if (response.ContentType == "image/jpeg") result = true; else result = false; } catch (Exception ex) { result = false; } finally { if (response != null) { response.Close(); } }
return result; }