我可以在聊天时间内获取另一个系统的IP地址吗 [英] can i get ip address of another system in chatting time

查看:54
本文介绍了我可以在聊天时间内获取另一个系统的IP地址吗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我可以在聊天时间内获取另一个系统的IP地址吗?

解决方案

尝试一下...

 字符串 ip;
  如果(Context.Request.ServerVariables [" ]!= )// 使用代理
  {
      ip = Context.Request.ServerVariables [" ].ToString();
      // 返回真实的客户端IP.
  }
  其他 // 不使用代理或无法获取代理客户端IP 
  {
      ip = Context.Request.ServerVariables [" ].ToString();
      // 虽然无法获取客户端IP,但它会返回代理IP.
  } 


hi
can i get ip address of another system in chatting time

解决方案

Try this...

string ip;
  if (Context.Request.ServerVariables["HTTP_VIA"] != null) // using proxy
  {
      ip = Context.Request.ServerVariables["HTTP_X_FORWARDED_FOR"].ToString();
      // Return real client IP.
  }
  else// not using proxy or can't get the Client IP
  {
      ip = Context.Request.ServerVariables["REMOTE_ADDR"].ToString();
      //While it can't get the Client IP, it will return proxy IP.
  }


这篇关于我可以在聊天时间内获取另一个系统的IP地址吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆