Wednesday, December 15, 2010

VB.NET Capture Client Computer NAME

 Imports System.Net

Dim computer_name() As String
        computer_name = Split(System.Net.Dns.GetHostEntry(Request.ServerVariables("remote_addr")).HostName, ".")
        Response.Write(computer_name(0).ToUpper)

OR

Dim strComputerName As String
        Dim host As System.Net.IPHostEntry
        host = System.Net.Dns.GetHostEntry(Request.ServerVariables.Item("REMOTE_HOST"))
        strComputerName = host.HostName
        Response.Write(strComputerName)

No comments: