Skip to content

Instantly share code, notes, and snippets.

@yemrekeskin
Created June 13, 2013 20:19
Show Gist options
  • Save yemrekeskin/5776995 to your computer and use it in GitHub Desktop.
Save yemrekeskin/5776995 to your computer and use it in GitHub Desktop.
Extention method for web service url address
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