Computer name in ASP
am 07.12.2004 20:20:50 von Shahid JumaHi,
How can I retrieve the computer name of the browser and output it to the
webpage in ASP/VBScript?
Thanks in advance,
Shahid
Hi,
How can I retrieve the computer name of the browser and output it to the
webpage in ASP/VBScript?
Thanks in advance,
Shahid
"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
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"
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
>
>
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
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"
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]"
> 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 -
Thanks,
I tried it and I get an "Access Denied", are there any permissions I need to
set?
Thanks,
Shahid
"Ray Costanzo [MVP]"
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"
> 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
> >
> >
>
>
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.
On Tue, 7 Dec 2004 14:20:50 -0500, "Shahid Juma"
>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