首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

怎么获得客户端IP地址信息

2012-01-10 
如何获得客户端IP地址信息有些网站把显示自己IP地址和网络类型,比如:56.168.0.100 南阳 电信请问这应该如

如何获得客户端IP地址信息
有些网站把显示自己IP地址和网络类型,比如:56.168.0.100 南阳 电信 
请问这应该如何实现?

[解决办法]
非常好弄特别简单!到discuz里下载一下数据库和一个dll文件就可以实现你要的效果了!详细效果请见:http://www.52shw.com/lylb.aspx?id=257和http://www.52shw.com/newspl.aspx?id=9184
[解决办法]
public static string GetIP()
{
string ip = "";

if (HttpContext.Current.Request.ServerVariables["HTTP_VIA"] != null)
{
ip = HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"].ToString();
}
else
{
ip = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"].ToString();
}

return ip;
}
[解决办法]

探讨
public static string GetIP()
{
string ip = "";

if (HttpContext.Current.Request.ServerVariables["HTTP_VIA"] != null)
{
ip = HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"].ToString();
}
else
{
ip = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"].ToString();
}



[解决办法]
这两个方法都行
非常好弄特别简单!到discuz里下载一下数据库和一个dll文件就可以实现你要的效果了!详细效果请见:http://www.52shw.com/lylb.aspx?id=257和http://www.52shw.com/newspl.aspx?id=9184
探讨
public static string GetIP()
{
string ip = "";

if (HttpContext.Current.Request.ServerVariables["HTTP_VIA"] != null)
{
ip = HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"].ToString();
}
else
{
ip = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"].ToString();
}


热点排行