反向DNS查找到https over vpn无法解析

时间:2015-02-19 20:36:11

标签: asp.net https vpn reverse-dns

我执行反向DNS查找以确定用户是否在适当的域上,以便根据其特定要求定制体验,并且下面的代码正常工作,除非在以下特定实例下。

通过VPN连接到站点并通过https://(vpn和http://按预期工作)抛出以下错误:" 错误:请求的名称有效,但没有找到所请求类型的数据。"

仔细研究后,系统返回一个奇怪的计算机名称(例如:3EDs45F46FG),而不是预期的反向查询(例如:ws234.domainName.com)

Public Shared Function GetDomain() As String
    Dim RQST As System.Web.HttpRequest
    RQST = HttpContext.Current.Request
    Return ReverseLookup(RQST.UserHostName)'UserHostName as ip address
End Function    

Public Shared Function ReverseLookup(ip As String) As String
    Dim netDns As System.Net.Dns
    Try
        Dim host As New IPHostEntry 
        host = netDns.GetHostEntry(ip)
        Return host.HostName & "<BR><BR>ip: " & ip

    Catch ex As System.Net.Sockets.SocketException
        Return "Error: " & ex.Message & "<BR><BR>" & "ip: " & ip
    End Try
End Function

0 个答案:

没有答案