zoukankan      html  css  js  c++  java
  • asp.net 取得远程的IP地址和浏览器类型

    /############################################
    版权声明:
    文章内容为本站编辑,创作.你可以任意转载、发布、使用但请务必明文标注文章原始出处及本声明
    http://www.opent.cn  作者:浪淘沙
    ############################################/

    #region 取得远程的IP地址和浏览器类型
            /// <summary>
            /// 取得远程的IP地址和浏览器类型
            /// </summary>
            /// <returns></returns>
            public static string GetIp()
            {
                string str = "";
                //穿过代理服务器取远程用户真实IP地址:
                if (System.Web.HttpContext.Current.Request.ServerVariables["HTTP_VIA"] != null)
                    str = System.Web.HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"].ToString();
                else
                    str = System.Web.HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"].ToString();

                HttpBrowserCapabilities bc = new HttpBrowserCapabilities();
                bc = System.Web.HttpContext.Current.Request.Browser;
                str += "&nbsp;你的操作系统:" + bc.Platform + " 浏览器:" + bc.Type;
                return str;
            }
            #endregion

  • 相关阅读:
    [HDOJ3567]Eight II
    [HDOJ3622]Bomb Game
    HTML 5 音频
    下拉菜单
    固定导航及右侧固定广告
    隔行换色
    返回顶部
    HTML 5 视频
    TAB切换
    自我介绍
  • 原文地址:https://www.cnblogs.com/zhangchenliang/p/736711.html
Copyright © 2011-2022 走看看