且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在经典的ASP中,如何获取客户端计算机的IP地址,名称和计算机描述

更新时间:2022-04-06 22:41:40

由于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.