Monday, May 27, 2013

Website URL validation in C#

 public bool UrlValidation(string websiteUrl)
    {                var websitePart = websiteUrl.Split('.');
                    if (websitePart.Length > 2) {
                    if (websitePart[0] == "www" && websitePart[1].Length > 1 && websitePart[websitePart.Length - 1].Length < 4 && websitePart[websitePart.Length - 1].Length > 1) {
                    return true;
                    }
                    else {
                      
                        return false;
                    }
                }
                else {
                   
                    return false;
                }
}