DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Hello I'm yunus emre.I'm a 24 year old.I have been living in istanbul,Turkey.I'm incredibly passionate about what I do and enjoy working with other open minded, enthusiastic people. I also like to share my experiences with others and blog regularly here. Buzz Words : .NET 2.0 and upwards C# ASP.NET (Web Forms, MVC, Web API) HTML/CSS MSSQL RavenDB Various Data Access libraries - from Disconnected and connected for SqlClient, NHibernate and Entity Framework I currently have been working as a software engineer in intertech.I am developing software to functional requirements and fixing bugs on banking platform using microsoft technologies in here. I'm interested in backend software development and enterprise software organizations.I'm keen on mostly about software architectures , design patterns , object oriented programming and enterprise software development.I have wrote articles in my own blog and communities about these topics.Also i like drawing software diagrams To become a good software engineer requires a good theoretical background as well as practical experiences.Therefore I will try to improve myself daily.New technologies and experiences raises new ideas and so we can change the world with these ideas.I believe that. I want to develop software on international projects in a international atmosphere Yunus Emre has posted 10 posts at DZone. You can read more from them at their website. View Full User Profile

Extention method for validation web service address

01.08.2014
| 2070 views |
  • submit to reddit
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;
    }
}

Our projects consist of many web service and it’s so important that have usedapplication-to -application communications and these url address of web services must be valid.Because be valid or be running web service doesn’t  affect single app , affect all apps.

i am coded a extention method for validation web service address , in below code snippet you can see it