(急)如何准确获取客户端真实的ip及地点 有时候用别的方法获取的ip都是192.168.0.1这类的ip,不是真实的ip,请问一下大家,用js怎么获取真实的ip和地点,谢谢! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 1、String user_IP=Request.ServerVariables["REMOTE_ADDR"].ToString(); 取远程用户IP地址 2、穿过代理服务器取远程用户真实IP地址: if(Request.ServerVariables["HTTP_VIA"]!=null){ string user_IP=Request.ServerVariables["HTTP_X_FORWARDED_FOR"].ToString(); }else{ string user_IP=Request.ServerVariables["REMOTE_ADDR"].ToString(); } 1、String user_IP=Request.ServerVariables["REMOTE_ADDR"].ToString(); 取远程用户IP地址 2、穿过代理服务器取远程用户真实IP地址: if(Request.ServerVariables["HTTP_VIA"]!=null){ string user_IP=Request.ServerVariables["HTTP_X_FORWARDED_FOR"].ToString(); }else{ string user_IP=Request.ServerVariables["REMOTE_ADDR"].ToString(); } 这个问题我曾经也弄了很久...现在用的是这个//IP地址 string ip = "" ; System.Web.HttpContext context = System.Web.HttpContext.Current; if (context.Request.ServerVariables["HTTP_VIA"] != null)//判断是否有代理 { ip = context.Request.ServerVariables["HTTP_X_FORWARDED_FOR"].ToString(); } else { ip = context.Request.ServerVariables["REMOTE_ADDR"].ToString(); } 通过httpwebrequest到ip138获取IP和地区名称或http://topic.csdn.net/u/20090617/11/8f0432b6-84ee-49da-a55f-86b3d343ab8b.html 刚刚申请的帐号! 菜鸟问题 关于考勤系统 求ASP.net中TextBox控件序列化的正确方法! 如何使用服务器变量的值? 很菜的问题弹出框的问题 急~!在线等待 $ 符号 在 Xslt 里面 是什么? 编写注释问题 关于treeview和框架结合的问题 c#,vb的项目可以合并呢? 又是datagrid分頁問題﹐真。。。。 在线等 名称以无效字符开头。处理资源 'file:///E:/查询/WebSite1/xg.aspx' 时出错。第 1 行,位置: 2 ASP.net编译出错,CS0006未找到元数据文件System.dll
取远程用户IP地址 2、穿过代理服务器取远程用户真实IP地址:
if(Request.ServerVariables["HTTP_VIA"]!=null){
string user_IP=Request.ServerVariables["HTTP_X_FORWARDED_FOR"].ToString();
}else{
string user_IP=Request.ServerVariables["REMOTE_ADDR"].ToString();
}
取远程用户IP地址 2、穿过代理服务器取远程用户真实IP地址:
if(Request.ServerVariables["HTTP_VIA"]!=null){
string user_IP=Request.ServerVariables["HTTP_X_FORWARDED_FOR"].ToString();
}else{
string user_IP=Request.ServerVariables["REMOTE_ADDR"].ToString();
}
//IP地址
string ip = "" ;
System.Web.HttpContext context = System.Web.HttpContext.Current;
if (context.Request.ServerVariables["HTTP_VIA"] != null)//判断是否有代理
{
ip = context.Request.ServerVariables["HTTP_X_FORWARDED_FOR"].ToString();
}
else
{
ip = context.Request.ServerVariables["REMOTE_ADDR"].ToString();
}
http://topic.csdn.net/u/20090617/11/8f0432b6-84ee-49da-a55f-86b3d343ab8b.html