The Windows Hosts file allows you to associate an IP to a host name that has far greater freedom than a normal Internet domain name. I\'d like to create a function that dete
These methods are not reliable as you get some response even if the domain name is fake like "fasdfasdfasd.com".
The best way is to send a WebResponse and wait for the response from the domain. Here is the complete code and explanations of this process (long code snippet so not copy-pasting here).
http://www.dotnetfunda.com/articles/show/1072/validating-domain-name-in-aspnet
Thanks
How about the System.Uri.CheckHostName() method?
private static bool IsValidDomainName(string name)
{
return Uri.CheckHostName(name) != UriHostNameType.Unknown;
}
Why do the work yourself?