ComputerName of Remote User

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • dthmtlgod

    ComputerName of Remote User

    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("W Script.Network" )
    response.write (wshNetwork.Com puterName)

    Also tried this and I get a permissions error.

    Set Sys = CreateObject("A DSystemInfo")
    response.write (sys.ComputerNa me)



  • Ray Costanzo [MVP]

    #2
    Re: ComputerName of Remote User

    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.ServerV ariables("REMOT E_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("W Script.Shell")
    Set oExec = oShell.Exec(sCo mmand)
    sOutput = oExec.StdOut.Re adAll
    Set oExec = Nothing
    Set oShell = NOthing
    Response.WRite sOutput
    %>

    Ray at work


    "dthmtlgod" <dvanderm@twcny .rr.com> wrote in message
    news:ufgJCF4iEH A.644@tk2msftng p13.phx.gbl...[color=blue]
    >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("W Script.Network" )
    > response.write (wshNetwork.Com puterName)
    >
    > Also tried this and I get a permissions error.
    >
    > Set Sys = CreateObject("A DSystemInfo")
    > response.write (sys.ComputerNa me)
    >
    >
    >[/color]


    Comment

    • dthmtlgod

      #3
      Re: ComputerName of Remote User

      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:eq3FTW4iEH A.396@TK2MSFTNG P12.phx.gbl...[color=blue]
      > 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.ServerV ariables("REMOT E_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("W Script.Shell")
      > Set oExec = oShell.Exec(sCo mmand)
      > sOutput = oExec.StdOut.Re adAll
      > Set oExec = Nothing
      > Set oShell = NOthing
      > Response.WRite sOutput
      > %>
      >
      > Ray at work
      >
      >
      > "dthmtlgod" <dvanderm@twcny .rr.com> wrote in message
      > news:ufgJCF4iEH A.644@tk2msftng p13.phx.gbl...[color=green]
      > >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("W Script.Network" )
      > > response.write (wshNetwork.Com puterName)
      > >
      > > Also tried this and I get a permissions error.
      > >
      > > Set Sys = CreateObject("A DSystemInfo")
      > > response.write (sys.ComputerNa me)
      > >
      > >
      > >[/color]
      >
      >[/color]


      Comment

      Working...