Question

If I have the following CNAME records set up:

www.custom1.com     CNAME   www.myapp.com
www.myapp.com       CNAME   myapp.cloudapp.net

Will Dns.GetHostEntry("www.custom1.com") always return a HostName of myapp.cloudapp.net.

Essentially I'm allowing customers to use their own custom domains for an application hosted in Azure and would rather ask them to set up a CNAME record to my domain (e.g. www.myapp.com) than giving out the Azure hostname.

I'm just looking for a way to programatically check that the cname record has been set up correctly.

Was it helpful?

Solution

Have a look at the DnDns library, it will allow you to do exactly what you are looking for. The 'How to do a DNS Name Lookup' documentation example should be easily adopted to your needs. (The example involves an A record, but changing it to a CNAME would be easy).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top