Created
June 13, 2013 20:19
-
-
Save yemrekeskin/5776995 to your computer and use it in GitHub Desktop.
Extention method for web service url address
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static class WebServiceExtention | |
| { | |
| public static bool isValidWebServiceUrl(this string url) | |
| { | |
| bool rv = true; | |
| if (String.IsNullOrEmpty(url)) | |
| rv = false; | |
| string Http_URL = HttpUtility.UrlDecode(url); | |
| HttpWebRequest ObjReq = (HttpWebRequest)HttpWebRequest.Create(Http_URL); | |
| ObjReq.Timeout = 36000; | |
| ObjReq.UseDefaultCredentials = true; | |
| try | |
| { | |
| if (ObjReq.GetResponse().ContentLength < 0) | |
| rv = false; | |
| } | |
| catch (Exception) | |
| { | |
| rv = false; | |
| } | |
| return rv; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment