Click to See Complete Forum and Search --> : Read client - hostname


il_betto
09-01-2009, 04:39 AM
Hi to All,

before posting I have read the topics of this forum and I saw in internet interesting articles reltative to my problem,
but,
up to now i' m not able to solve it...

I have a page.asp,
and I want to catch, to extract the name of the client, of the host that in intranet open my page ...

I have tried in different ways but the results are:

<%@ Language=VBScript %>
<% Option Explicit %>
<html>
<head>
<meta http-equiv="Content-Language" content="it">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>AAA</title>
</head>
<body>
<pre>
<%=Request.ServerVariables("REMOTE_HOST")%>
<%=Request.ServerVariables("REMOTE_ADRR")%>
<%=Request.ServerVariables("HTTP_HOST")%>
<%=Request.ServerVariables("HTTP_REFERER")%>
</pre>

REMOTE_HOST and REMOTE_ADRR give me both the IP adress,
HTTP_HOST returns the server name and not the client name,
HTPP_REFERER returns nothing ...

I have IIS,
I saw the property of Services of my Server and I controlled that NetBios is enabled,
I have even seen my FireWall,

what I want is to extract the information of the client that for example can be reached with regedit in:

HKEY_LOCAL_MACHINE / SYSTEM / ControlSet001 / Control / ComputerName / computerName

Thanks a lot in advance for Your attention !!!

Kuriyama
09-01-2009, 07:56 AM
I'm not sure this is going to be obtainable without a COM component add on. The computer name isn't going to be sent to the server as a header, simply because it's not needed.

If you have the IP address of your user, you should be able to preform an IP address lookup on your DHCS server to find the computer name.

This isn't out of the box classic ASP functionality though.

il_betto
09-02-2009, 08:53 AM
I have controlled the different voices inside Control Panel / Services of the Server,
but I am not able to display the name of the host name
(remote client that executes via browser the server page.asp)

Is it possible with normal ASP (not ASP.NET) to read this information, or not ???

:confused:

Kuriyama
09-02-2009, 09:27 AM
I have controlled the different voices inside Control Panel / Services of the Server,
but I am not able to display the name of the host name
(remote client that executes via browser the server page.asp)

Is it possible with normal ASP (not ASP.NET) to read this information, or not ???

:confused:

No this isn't possible with out of the box ASP code. You might want to look for a COM component that will suite your needs.

il_betto
09-02-2009, 10:05 AM
Thanks Kuriyama for the idea:

I didn' t know the existence of COM,
I read now in internet that is possible to create a new dll to submit ...

Is there some useful code, or some links, to solve my problem ... ???

Kuriyama
09-02-2009, 10:26 AM
Thanks Kuriyama for the idea:

I didn' t know the existence of COM,
I read now in internet that is possible to create a new dll to submit ...

Is there some useful code, or some links, to solve my problem ... ???

This is such a rare request, and COM components are so rare with the advent of .NET.

My recommendation would be to try to use .NET, you can call .NET objects/functionality through classic ASP.

I'm not going to be able to provide you with any useful code. I haven't written a COM component in 3 years. I would ask this question in the .NET forums and see if anyone there can provide you with a solution.

Sorry.

EDIT*

Found one link that you can use using WSH.

http://www.tek-tips.com/viewthread.cfm?qid=1086013&page=7

It's possible to set up a framework that will read the clients machine name then post it back via AJAX call to the server, so that it then has access.

il_betto
09-02-2009, 10:35 AM
Thanks a lot again for your time and precious helps ...

I will try to do some tests following your idea and then,
if i will reach the solution,
I will post it, sure ...

Thanks !!!

il_betto
09-08-2009, 08:32 AM
I have received a big external help, and now I have solved the problem !!

The code remains the same:
here I put the only variable that returns remote hostname that submits or opens the server page.asp

<%@ Language=VBScript %>
<% Option Explicit %>
<html>
<head>
<meta http-equiv="Content-Language" content="it">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>AAA</title>
</head>
<body>
<pre>
<%=Request.ServerVariables("REMOTE_HOST")%>
</pre>


But BEFORE we have to do these things on the Server:

1. open DOS window:
2. go to folder C:\Inetpub\AdminScripts
3. write this sintax:
CScript.Exe adsutil.vbs set w3svc/EnableReverseDNS TRUE

in this way is set not the IP adress to be received, but the hostname

:D:D:D:D