The Web server will have the IP address of the remote computer, assuming
there is no proxy server, firewall, etc. between the remote computer and
your server. So, if you have the IP address, you can attempt to do a
reverse DNS lookup to convert the IP to the hostname. The quick and dirty
way to do it would be to "ping -a" the IP. Ping with the -a switch will
attempt to resolve the IP to a hostname.
Example:
<%
Dim sIP
Dim oShell, oExec, sCommand, sOutput
sIP = Request.ServerVariables("REMOTE_ADDR")
sCommand = "%comspec% /c @echo off & for /f ""tokens=2"" %q in ('ping -n
1 -a " & sIP & "^|find /i ""pinging""') do echo %q"
Set oShell = CreateObject("WScript.Shell")
Set oExec = oShell.Exec(sCommand)
sOutput = oExec.StdOut.ReadAll
Set oExec = Nothing
Set oShell = NOthing
Response.WRite sOutput
%>
Ray at work
"dthmtlgod" <dv******@twcny.rr.com> wrote in message
news:uf*************@tk2msftngp13.phx.gbl...
I am attempting to retrieve the computer name of a remote user accessing
our
websever. I have tried the following and both don't work. Any ideas?
Returns the webserver computer name
Set WshNetwork = CreateObject("WScript.Network")
response.write (wshNetwork.ComputerName)
Also tried this and I get a permissions error.
Set Sys = CreateObject("ADSystemInfo")
response.write (sys.ComputerName)