Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > ComputerName of Remote User

Reply
Thread Tools

ComputerName of Remote User

 
 
dthmtlgod
Guest
Posts: n/a
 
      08-26-2004
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)



 
Reply With Quote
 
 
 
 
Ray Costanzo [MVP]
Guest
Posts: n/a
 
      08-26-2004
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>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)
>
>
>



 
Reply With Quote
 
 
 
 
dthmtlgod
Guest
Posts: n/a
 
      08-26-2004
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:(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> >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)
> >
> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
computername:port not work instead localhost amjad ASP .Net 0 11-24-2005 05:02 AM
computername Mindy Geac ASP General 7 05-27-2005 06:42 AM
Gather Local ComputerName Joseph ASP .Net 2 04-23-2004 05:14 PM
How to grap computername Ryd ASP General 2 02-19-2004 05:19 PM
can asp.net get the computername? Jason Shohet ASP .Net 1 01-15-2004 09:30 PM



Advertisments