当前位置:编程学习 > asp >>

获取登录IP

View Code
 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         }

 

摘自  完美饰物
 
补充:Web开发 , ASP.Net ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,