如何获得访问者的浏览器类型,ip地址或更多

代码:

<!DOCTYPE html>
<html>
<body>
<p>
<b>You are browsing this site with:</b>
<%Response.Write(Request.ServerVariables("http_user_agent"))%>
</p>
<p>
<b>Your IP address is:</b>
<%Response.Write(Request.ServerVariables("remote_addr"))%>
</p>
<p>
<b>The DNS lookup of the IP address is:</b>
<%Response.Write(Request.ServerVariables("remote_host"))%>
</p>
<p>
<b>The method used to call the page:</b>
<%Response.Write(Request.ServerVariables("request_method"))%>
</p>
<p>
<b>The server's domain name:</b>
<%Response.Write(Request.ServerVariables("server_name"))%>
</p>
<p>
<b>The server's port:</b>
<%Response.Write(Request.ServerVariables("server_port"))%>
</p>
<p>
<b>The server's software:</b>
<%Response.Write(Request.ServerVariables("server_software"))%>
</p>
<br />
</body>
</html>

结果:

You are browsing this site with:

Your IP address is: 42.120.45.233

The DNS lookup of the IP address is: 42.120.45.233

The method used to call the page: GET

The server's domain name: w3cschool.cc

The server's port: 80

The server's software: Microsoft-IIS/7.5

相关文章