Reverse DNS Lookup from ASP.Net

My client needs to be able to restrict page content based on the client machine name on their intranet site. I knew that you could get the IP address from the REMOTE_HOST HTTP header, and some exploration of the System.Net namespace revealed that you can use the System.Net.Dns.GetHostByAddress method to perform a reverse DNS look up to get the machine name. Here’s a VB.Net example:

Dim strIp As String
Dim he As System.Net.IPHostEntry
Dim strHostName As String
strIp = Me.Request.ServerVariables("REMOTE_HOST")
he = System.Net.Dns.GetHostByAddress(strIp)
strHostName = he.HostName