|
Home > Archive > IIS ASP > August 2004 > ComputerName of Remote User
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
ComputerName of Remote User
|
|
| dthmtlgod 2004-08-27, 6:17 pm |
| 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)
| |
| Ray Costanzo [MVP] 2004-08-27, 6:17 pm |
| 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" <dvanderm@twcny.rr.com> wrote in message
news:ufgJCF4iEHA.644@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)
>
>
>
| |
| dthmtlgod 2004-08-27, 6:17 pm |
| Thanks a lot Ray, firewall is preventing me from obtaining the computer
name. Token 2 is the IP address.
"Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote in
message news:eq3FTW4iEHA.396@TK2MSFTNGP12.phx.gbl...
> 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" <dvanderm@twcny.rr.com> wrote in message
> news:ufgJCF4iEHA.644@tk2msftngp13.phx.gbl...
>
>
|
|
|
|
|