Computer name in ASP

Computer name in ASP

am 07.12.2004 20:20:50 von Shahid Juma

Hi,

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

Thanks in advance,
Shahid

Re: Computer name in ASP

am 07.12.2004 20:27:06 von Rob Meade

"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

Re: Computer name in ASP

am 07.12.2004 20:35:21 von unknown

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" wrote in message
news:uw0f5DJ3EHA.936@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
>
>

Re: Computer name in ASP

am 07.12.2004 20:39:13 von Mike Brind

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

Re: Computer name in ASP

am 07.12.2004 21:02:49 von unknown

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" wrote in message
news:ebbgvbJ3EHA.2804@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]" wrote in
> message news:%23OC8mPJ3EHA.1264@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 -

Re: Computer name in ASP

am 07.12.2004 21:03:29 von Shahid Juma

Thanks,

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

Thanks,
Shahid

"Ray Costanzo [MVP]" wrote in
message news:%23OC8mPJ3EHA.1264@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" wrote in message
> news:uw0f5DJ3EHA.936@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
> >
> >
>
>

Re: Computer name in ASP

am 07.12.2004 22:16:15 von Mike Brind

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.

Re: Computer name in ASP

am 07.12.2004 22:18:57 von jeff.nospam

On Tue, 7 Dec 2004 14:20:50 -0500, "Shahid Juma"
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