If I have a website running at www.example.com, but someone accesses it by IP address. How can I in code lookup in IIS that www.example.com is the actual site’s domain?
If I have a website running at www.example.com , but someone accesses it by
Share
It’s not possible to reliably look up a domain based on an IP address because an IP address can be mapped to 0 or more domain names.
The best you can do is have a list of mappings. Note that it’s also possible for a local network IP address and an external IP point to the same location.
In general, a specific machine can be referenced by several IPs, each of which can be referenced by several domains. So you can go
domain > IP address -> machinebut not the other way around.