【转】C#如何获取客户端/服务端IP地址

客户端ip:
Request.ServerVariables.Get("Remote_Addr").ToString();
客户端主机名:
Request.ServerVariables.Get("Remote_Host").ToString();
客户端浏览器IE:
Request.Browser.Browser;
客户端浏览器 版本号:
Request.Browser.MajorVersion;//
客户端操作系统:
Request.Browser.Platform;

服务器ip:
Request.ServerVariables.Get("Local_Addr").ToString();
服务器名:
Request.ServerVariables.Get("Server_Name").ToString();

如果你想进一步了解ServerVariables,可以用
foreach(String o in Request.ServerVariables){
Response.Write(o+"="+Request.ServerVariables[o]+"<br>");
}


原文地址:https://www.cnblogs.com/luckylei66/p/2103136.html