469,356 Members | 1,999 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,356 developers. It's quick & easy.

Computer name in ASP

Hi,

How can I retrieve the computer name of the browser and output it to the
webpage in ASP/VBScript?

Thanks in advance,
Shahid
Jul 22 '05 #1
7 10835
"Shahid Juma" wrote ...
How can I retrieve the computer name of the browser and output it to the
webpage in ASP/VBScript?


Of the client computer I don't think you'll be able to being that the ASP
will be run server side...

Not sure if you can extract this with Javascript - I'd be surprised though
for security reasons etc...

Something here:

http://www.experts-exchange.com/Web/Q_20595825.html

Regards

Rob
Jul 22 '05 #2
Here's a poor-man's method that works well in an intranet environment. It
pings the remote_addr using the -a switch which asks that ping.exe return
the hostname, if it can be reverse-resolved:

<%
Dim sIP
Dim oShell, oExec, sCommand, sOutput
sIP = Request.ServerVariables("REMOTE_ADDR")
''watch for line wrap - begin
sCommand = "%comspec% /c @echo off & for /f ""tokens=2"" %q in ('ping -n
1 -a " & sIP & "^|find /i ""pinging""') do echo %q"
''watch for line wrap - end
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

"Shahid Juma" <sh*****************@hotmail.com> wrote in message
news:uw*************@TK2MSFTNGP12.phx.gbl...
Hi,

How can I retrieve the computer name of the browser and output it to the
webpage in ASP/VBScript?

Thanks in advance,
Shahid

Jul 22 '05 #3
Shahid Juma wrote:
Hi,

How can I retrieve the computer name of the browser and output it to the
webpage in ASP/VBScript?

Thanks in advance,
Shahid


What do you mean by "computer name"?

Mike Brind
Jul 22 '05 #4
Thanks,

I tried it and I get an "Access Denied", are there any permissions I need to
set?

Thanks,
Shahid

"Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote in
message news:%2****************@TK2MSFTNGP12.phx.gbl...
Here's a poor-man's method that works well in an intranet environment. It
pings the remote_addr using the -a switch which asks that ping.exe return
the hostname, if it can be reverse-resolved:

<%
Dim sIP
Dim oShell, oExec, sCommand, sOutput
sIP = Request.ServerVariables("REMOTE_ADDR")
''watch for line wrap - begin
sCommand = "%comspec% /c @echo off & for /f ""tokens=2"" %q in ('ping -n
1 -a " & sIP & "^|find /i ""pinging""') do echo %q"
''watch for line wrap - end
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

"Shahid Juma" <sh*****************@hotmail.com> wrote in message
news:uw*************@TK2MSFTNGP12.phx.gbl...
Hi,

How can I retrieve the computer name of the browser and output it to the
webpage in ASP/VBScript?

Thanks in advance,
Shahid


Jul 22 '05 #5
Check the NTFS permissions on %windir%\system32\ping.exe. Oddly, on my
computer (XP SP1), ping.exe has my IUSR account specifically denied. When I
run this on a W2K Server, however, all is fine.

Also check the permissions on your cmd.exe (%comspec%). Permissions are
explicitely denied on this file as well.

Ray at work

"Shahid Juma" <sh*****************@hotmail.com> wrote in message
news:eb**************@TK2MSFTNGP15.phx.gbl...
Thanks,

I tried it and I get an "Access Denied", are there any permissions I need to set?

Thanks,
Shahid

"Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote in
message news:%2****************@TK2MSFTNGP12.phx.gbl...
Here's a poor-man's method that works well in an intranet environment. It pings the remote_addr using the -a switch which asks that ping.exe return the hostname, if it can be reverse-resolved:

<%
Dim sIP
Dim oShell, oExec, sCommand, sOutput
sIP = Request.ServerVariables("REMOTE_ADDR")
''watch for line wrap - begin
sCommand = "%comspec% /c @echo off & for /f ""tokens=2"" %q in ('ping -

Jul 22 '05 #6
Mike Brind wrote:
Shahid Juma wrote:
Hi,

How can I retrieve the computer name of the browser and output it to the
webpage in ASP/VBScript?

Thanks in advance,
Shahid


What do you mean by "computer name"?

Mike Brind


Answered in other replies.
Jul 22 '05 #7
On Tue, 7 Dec 2004 14:20:50 -0500, "Shahid Juma"
<sh*****************@hotmail.com> wrote:
Hi,

How can I retrieve the computer name of the browser and output it to the
webpage in ASP/VBScript?


Does Request.ServerVariables("REMOTE_HOST") get you what you need?

Jeff
Jul 22 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Jim Scheffler | last post: by
5 posts views Thread by z. f. | last post: by
5 posts views Thread by ThunderMusic | last post: by
6 posts views Thread by Spyder | last post: by
1 post views Thread by Lamis | last post: by
7 posts views Thread by =?Utf-8?B?TWljaGFlbCBkZSBWZXJh?= | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.