使用Privoxy的/ TOR C# [英] C# using Privoxy/TOR
问题描述
我找到很多例子,如何使用的Privoxy / TOR的代理。例如:如何使用Tor做一个C#的HttpWebRequest 一>
I find many example how use Privoxy/TOR for proxy. For example: How to use Tor to make a C# HttpWebRequest
首先,我安装捆绑软件包比也Privoxy的
First I installed Vidalia Bundle and than also Privoxy.
捆绑软件包使用地址127.0.0.1:使用地址9115结果
Privoxy的127.0.0.1:8118
Vidalia Bundle using address 127.0.0.1:9115
Privoxy using address 127.0.0.1:8118
我尝试在代码中创建的服务器<请求HREF =HTTP:// whatismyipaddress。 COM /相对=nofollow> http://whatismyipaddress.com/ 。
I try in code create request on server 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地址。我做错了什么? 。任何提前,谢谢
But this server still see my IP address. What I am doing wrong ? Any advance, thank you.
编辑,与leppie建议:
我使用这个构造:
Edit, with leppie advice: I use this constructor :
request.Proxy = new WebProxy("127.0.0.1",8118);
但服务器仍然看到我的IP地址。 (
But server still see my IP adress. :(
应用程序在端口8118我盼着需要使用的Privoxy 9115 - 这是TOR端口
Application is using Privoxy on port 8118. I need foward on 9115-this is TOR port.
推荐答案
这适用于远程代理:
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();
这篇关于使用Privoxy的/ TOR C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!