1 /// <summary>
2 /// 获取登录IP
3 /// </summary>
4 /// <returns></returns>
5 private string GetIP()
6 {
7 string l_ret = string.Empty;
8 if (!string.IsNullOrEmpty(System.Web.HttpContext.Current.Request.ServerVariables["HTTP_VIA"]))
9 l_ret = Convert.ToString(System.Web.HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"]);
10 if (string.IsNullOrEmpty(l_ret))
11 l_ret = Convert.ToString(System.Web.HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"]);
12 return l_ret;
13 }