zoukankan      html  css  js  c++  java
  • 如何用C#及JS得到服务器端和客户端的IP

    <%
    //c#的作法
    //客户端IP:cIP
    string cIP=HttpContext.Current.Request.UserHostAddress.Trim();
    //服务器端IP:sIP;
    string sIP=Request.ServerVariables.Get("Local_Addr").ToString();
    %>
    <script>
    //客户端IP:cip;
    var obj = new ActiveXObject("rcbdyctl.Setting");
    var cip = obj.GetIPAddress;
    //服务器端IP:sip;
    var sip=location.host;
    </script>

    另外还有其它(c#)
    客户端ip:
    Request.ServerVariables.Get("Remote_Addr").ToString();
    客户端主机名:
    Request.ServerVariables.Get("Remote_Host").ToString();
    客户端浏览器IE:
    Request.Browser.Browser;
    客户端浏览器 版本号:
    Request.Browser.MajorVersion;//
    客户端操作系统:
    Request.Browser.Platform;
    服务器名:
    Request.ServerVariables.Get("Server_Name").ToString();

  • 相关阅读:
    多表查询,连表查询
    mysql数据概念难点
    mysql练习题
    linux下 redis
    nginx安装
    八皇后问题 OpenJ_Bailian
    Prime Ring Problem hdu-1016 DFS
    Oil Deposits hdu-1241 DFS
    Highways
    畅通工程再续
  • 原文地址:https://www.cnblogs.com/freeliver54/p/670397.html
Copyright © 2011-2022 走看看