Use
Uri.IsWellFormedUriString
to check whether the URL is in correct form.
For example,
Uri.IsWellFormedUriString("http://www.google.com", UriKind.Absolute);
It'll return true as the URL is in correct form.
To check the existence of a URL create a
WebRequest
:
WebRequest request = WebRequest.Create("http://www.google.com");
try
{
request.GetResponse();
}
catch
{
MessageBox.Show("The URL is incorrect");
}