can some one tell me how can i validate a url like http://www.abc.com
Let the System.Uri do the heavy lifting for you, instead of a RegEx:
public class UrlAttribute : ValidationAttribute
{
public UrlAttribute()
{
}
public override bool IsValid(object value)
{
var text = value as string;
Uri uri;
return (!string.IsNullOrWhiteSpace(text) && Uri.TryCreate(text, UriKind.Absolute, out uri ));
}
}