<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></body></html>
评论会员:安东尼Ğ王子 时间:2012/02/07
publicstaticstring getclientIP()
{
string result= string.Empty;
string ip = HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
if (!string.IsNullOrEmpty(ip))
{
string[] ipRange = ip.Split(',');
int le = ipRange.Length - 1;
result = ipRange[0];
}
else
{
result = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
}
return result;
}