2

I find many example how use Privoxy/TOR for proxy. For example: How to use Tor to make a C# HttpWebRequest

First I installed Vidalia Bundle and than also Privoxy.

Vidalia Bundle using address 127.0.0.1:9115
Privoxy using address 127.0.0.1:8118

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();
    }
}

But this server still see my IP address. What I am doing wrong ? Any advance, thank you.

Edit, with leppie advice: I use this constructor :

   request.Proxy = new WebProxy("127.0.0.1",8118); 

But server still see my IP adress. :(

Application is using Privoxy on port 8118. I need foward on 9115-this is TOR port.

DIF
  • 2,470
  • 6
  • 35
  • 49
Tom
  • 129
  • 3
  • 11

2 Answers2

0

I suspect the url is wrong.

You should probably use the WebProxy(string Host, int Port) constructor.

leppie
  • 115,091
  • 17
  • 196
  • 297
  • I use this request.Proxy = new WebProxy("127.0.0.1",8118); , but the server still see my IP address :( – Tom Oct 18 '10 at 15:01
  • @Lucas: You will to debug the packets with WireShark or something. I can't help further. – leppie Oct 18 '10 at 15:11
0

This works for a remote proxy:

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();
DIF
  • 2,470
  • 6
  • 35
  • 49
as-cii
  • 12,819
  • 4
  • 41
  • 43
  • Have you tried to do the same thing with Internet Explorer? Try to set the proxy in there: navigate the page and if the server still sees the IP there is something wrong in Privoxy. – as-cii Oct 18 '10 at 15:26