zoukankan      html  css  js  c++  java
  • 获取真实Ip

            /// <summary>
            /// 获取真实IP
            /// </summary>
            /// <returns></returns>
            public static string GetRealIP()
            {
                string ip;
                try
                {
                    HttpRequest request = HttpContext.Current.Request;
                    if (request.ServerVariables["HTTP_VIA"] != null)
                    {
                        ip = request.ServerVariables["HTTP_X_FORWARDED_FOR"].ToString().Split(',')[0].Trim();
                    }
                    else
                    {
                        ip = request.UserHostAddress;
                    }
                }
                catch (Exception e)
                {
                    throw e;
                }
                return ip;
            }

  • 相关阅读:
    损失函数
    DPM 目标检测1
    编程题
    枚举型和元类
    python 多继承
    网络基础Cisco路由交换一
    网络基础tcp/ip协议五
    网络基础tcp/ip协议四
    网络基础tcp/ip协议三
    网络基础tcp/ip协议二
  • 原文地址:https://www.cnblogs.com/zhoubinbin1991/p/2880918.html
Copyright © 2011-2022 走看看