本文介绍了如果与公司域外的VPN连接,如何获取客户端计算机的IP地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想找到用户机器IP或任何其他参数可以帮助我识别系统是在公司域还是在公司域外连接(使用VPN连接)



我尝试过:



I want to find the users machine IP or any other parameter That can help me to identify whether a system is connected in company domain or outside company domain(connected using VPN)

What I have tried:

private string GetPublicIpAddress()
  {
      var request = (HttpWebRequest)WebRequest.Create("http://ifconfig.me");

      request.UserAgent = "curl"; // this simulate curl linux command

      string publicIPAddress;

      request.Method = "GET";
      using (WebResponse response = request.GetResponse())
      {
          using (var reader = new StreamReader(response.GetResponseStream()))
          {
              publicIPAddress = reader.ReadToEnd();
          }
      }

      return publicIPAddress.Replace("\n", "");
  }

推荐答案


这篇关于如果与公司域外的VPN连接,如何获取客户端计算机的IP地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 07:31
查看更多