简体   繁体   English

检索代理IP地址C#

[英]Retrieve Proxy IP address C#

I need to know what this proxy and in the past I used an IP webservice to get the IP. 我需要知道这个代理是什么,过去我使用IP网络服务来获取IP。 Is there was some way in C# to get the actually proxy IP address. C#中是否有某种方法可以获取实际的代理IP地址。

If I could just ping somewhere and get the IP that way that would be ideal. 如果我可以ping通某个地方并以这种方式获取IP,那将是理想的选择。

found a possible solution here 这里找到了可能的解决方案

protected void DNSLookup(string domain)
{
try
{
//performs the DNS lookup
IPHostEntry he = Dns.GetHostByName(domain);
IPAddress[] ip_addrs = he.AddressList;
txtIPs.Text = "";
foreach (IPAddress ip in ip_addrs)
{
txtIPs.Text += ip + "\n";
}
}
catch (System.Exception ex)
{
lblStatus.Text = ex.ToString();
}
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM