473,387 Members | 1,698 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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 11348
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Jim Scheffler | last post by:
I'm new to VB.NET programming and would like some help on a little project I've got going. How would I go about getting computer information on my local computer, i.e. serial number, hard drive...
4
by: Dr. StrangeDub | last post by:
Leaving network identification/DNS out of the picture, how does one change the name of a computer in a local Workgroup (in C#)? I implemented the SetComputerName() API call and that only seems to...
5
by: z. f. | last post by:
i need to get the computer name from an aspx page. i use System.Windows.Forms.SystemInformation.ComputerName() and it's working fine, but in second thought, it might not be recomended to use the...
0
by: Daylor | last post by:
hi. i have app that im developing in my computer with vs.net 2003 (offcourse). now, this app is running in other computer in the local intranet. in the other computer i dont have vs.net installed...
5
by: ThunderMusic | last post by:
Hi, I want to find the computer name and the company name from the network indentification informations. For the computer name, I found System.Net.Dns.GetHostName(), but I fgound nothing for...
6
by: Spyder | last post by:
When you go to "MyComputer" and get properties and select "Computer Name", you get the Domain or Workgroup a computer belongs to. I have looked thru MSDN library, the Internet, the Registry and in...
1
by: Lamis | last post by:
HI, I need to install a service that changes Host Name, computer name, on all our machines. I have tried to ways: First one: static void RenameHostName() { ManagementClass mComputerSystem =...
2
by: Vincent | last post by:
I have been trying to find some API routines that will allow me to determine the name of the computer that is accessing a file on a server. I have found the NetFileEnum call (returns the names of...
7
by: =?Utf-8?B?TWljaGFlbCBkZSBWZXJh?= | last post by:
to all, I was wondering if anyone has sample code that I can use to get information about a computer in active directory. For example, I want to know the date to when a computer was joined to a...
0
by: BrianT | last post by:
I'm trying to build code that allows the computer name to be changed, then asks the user to reboot to make the change affective. I got the code working when logged in as the local computer...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.