Validating domain name
In this article, I have tried to create a function that will check for a domain and if it exists it writes success message otherwise failure. NET How to'stored the output into a string variable.
Positive SSL Multi-Domain certs allow enterprises and web hosts to secure multiple websites by including up to 100 domains within a single certificate.
An aggregate root is responsible of maintaining the invariants encompassed by it, so validating them falls under its responsibility.
Domain Driven Design 101 has some nice examples starting at slide 44. "Instead of answering the question, “is this object valid”, try and answer the question, “Can this operation be performed?
But if the domain name doesn't exists then the that I have caught into the first catch block where I am assuming that this domain name is not valid/doesn't exists.
But if the error will be of some different type not related with the domain name or resolving the server then it will fall into the 2nd catch block where I have shown simple generic error message.
The source code of this example can be downloaded from the download link.