在经典的ASP中,如何获取客户端计算机的IP地址,名称和计算机描述 [英] in classic asp how to get client computer ip addr, name and computer description

查看:221
本文介绍了在经典的ASP中,如何获取客户端计算机的IP地址,名称和计算机描述的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友.

我已经尝试使用以下代码来获取客户端计算机名称和

friends.

i have tried the following code to get client computer name and

sFullUser1 =trim(Request.ServerVariables ("remote_addr))
Set objWMIService = GetObject("winmgmts:\\" & sFullUser1  & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem",,48)
For Each objItem in colItems
   response.write "BootDevice: " & objItem.CSName & 
  response.write "BuildNumber: " & objItem.Description
Next


但它仅提供服务器详细信息.但没有客户端系统详细信息.

请帮助我做到这一点.如何获得客户端计算机名称,计算机名称和IP地址.
就像我们在系统属性中所具有的一样->计算机名"选项卡


but it is giving only server details. but not the client system details.

Please help me in doing this. how could i get client computer name and computer dexcription and ip address.
as what we have in system properties->computer name tab

推荐答案

由于ASP代码在服务器上运行,由于安全原因,您无法收获某些有关您的用户系统的信息.

对于IP地址,您可以使用:

As the ASP code is run on the server, due to security reasons you are unable to harvest certain information about your users systems.

For the IP address, you may use:

<%
Dim UserIPAddress
UserIPAddress = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
If UserIPAddress = "" Then
  UserIPAddress = Request.ServerVariables("REMOTE_ADDR")
End If
%>



虽然您可以简单地使用:



Whilst you could just simply use:

Request.ServerVariables("REMOTE_ADDR")



当用户使用基于Office的代理时,这可能不起作用.



This might not work when the user is behind an office-based proxy.


这篇关于在经典的ASP中,如何获取客户端计算机的IP地址,名称和计算机描述的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆