如何获取IP地址,也就是说,当有人点击我们网站的时候把它的IP地址调出来 还有 点击数量 和 是从哪个网站跳到我们网站的
求大神帮帮忙。比较头疼,求思路 最好有代码
------解决方案--------------------------------------------------------
http://blog.csdn.net/yysyangyangyangshan/article/details/6803787
------解决方案--------------------------------------------------------
- C# code
/// <summary> /// 取客户端IP函数 /// </summary> /// <returns>取客户端IP函数</returns> public static string GetClientIP() { string m_sClientIP = HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (m_sClientIP == null || m_sClientIP == String.Empty) { m_sClientIP = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"]; } if (m_sClientIP == null || m_sClientIP == String.Empty) { m_sClientIP = HttpContext.Current.Request.UserHostAddress; } return m_sClientIP; }
------解决方案--------------------------------------------------------
string ip = Request.ServerVariables["REMOTE_ADDR"].ToString();
------解决方案--------------------------------------------------------
为什么不用封装好的,还有智能提示的Request.UserHostAddress