我找到了很多使用Privoxy/TOR作为代理的例子。例如:How to use Tor to make a C# HttpWebRequest
首先,我安装了Vidalia,然后还安装了Privoxy。
使用地址127.0.0.1:9115的Vidalia捆绑包
Privoxy使用地址127.0.0.1:8118
我在服务器http://whatismyipaddress.com/上尝试了代码创建请求。
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://whatismyipaddress.com/");
request.Proxy = new WebProxy("127.0.0.1:8118");
using (var response = request.GetResponse())
{
using (var reader = new StreamReader(response.GetResponseStream(), Encoding.GetEncoding("utf-8")))
{
webBrowser1.DocumentText = reader.ReadToEnd();
}
}但是这个服务器仍然可以看到我的IP地址。我做错了什么?任何预付款,谢谢。
编辑,带麻风的建议:我使用这个构造函数:
request.Proxy = new WebProxy("127.0.0.1",8118); 但是服务器仍然可以看到我的IP地址。:(
应用程序正在端口8118上使用Privoxy。我需要9115前线-这里是托尔港。
发布于 2010-10-18 22:23:51
我怀疑url是错误的。
您可能应该使用WebProxy(string Host, int Port)构造函数。
发布于 2010-10-18 23:15:32
这适用于远程代理:
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create("http://whatismyipaddress.com/");
request.Proxy = new WebProxy("110.139.166.78:8080");
using (var req = request.GetResponse())
{
using (StreamReader reader = new StreamReader(req.GetResponseStream()))
{
Console.WriteLine(reader.ReadToEnd());
}
}
Console.ReadLine();https://stackoverflow.com/questions/3960114
复制相似问题