ComputerName of Remote User

Discussion in 'ASP General' started by dthmtlgod, Aug 26, 2004.

  1. dthmtlgod

    dthmtlgod Guest

    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, Aug 26, 2004
    #1
    1. Advertising

  2. 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" <> wrote in message
    news:...
    >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], Aug 26, 2004
    #2
    1. Advertising

  3. dthmtlgod

    dthmtlgod Guest

    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:...
    > 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" <> wrote in message
    > news:...
    > >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, Aug 26, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jason Shohet

    can asp.net get the computername?

    Jason Shohet, Jan 15, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    1,278
    Kevin Spencer
    Jan 15, 2004
  2. Joseph

    Gather Local ComputerName

    Joseph, Apr 23, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    1,774
    Joseph
    Apr 23, 2004
  3. amjad
    Replies:
    0
    Views:
    549
    amjad
    Nov 24, 2005
  4. Mindy Geac

    computername

    Mindy Geac, May 26, 2005, in forum: ASP General
    Replies:
    7
    Views:
    132
    Roland Hall
    May 27, 2005
  5. Anatoli Hristov

    Change computername

    Anatoli Hristov, Oct 17, 2012, in forum: Python
    Replies:
    0
    Views:
    93
    Anatoli Hristov
    Oct 17, 2012
Loading...

Share This Page