title: how to make httpwebrequest via Tor
body: <p>im trying to make a request via the tor proxy</p>
  
  <pre><code>myRequest.Proxy = New WebProxy("127.0.0.1", 8118)
  </code></pre>
  
  <p>but this gives me an error
  <code>Unable to connect to the remote server</code></p>
  
  <p>and the inner exception is <code>No connection could be made because the target machine actively refused it 127.0.0.1:8118</code></p>
  
  <p>my reading shows this might be a firewall issue, so i turned off windows FW entirely, i also temporarily disabled my AVG AV. i don't have any other protections that im aware of</p>
  
  <p>for good measure i also tried 9050 &amp; 9051 as port numbers but that didn't help</p>
  
  <p>the Tor browser is working, so i guess my code should work as well. how do i set the proxy to use Tor.</p>
  
  <p>BTW, the "8118" is out of memory, i couldn't find any documentation as to which port i should use as the proxy</p>
  
  <p>maybe my tor is set to something else?</p>
  
  <p>thanks a million!</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>regarding privoxy: </p>
  
  <p>in the past (about a year ago or more) i just download tor, and then  added 8118 as the proxy and all worked. now it doesn't. maybe something changed?</p>
  
  <p>so i downloaded now privoxy as suggested by CodeCaster, now when both tor and privoxy are running, then the requests work, but, im afraid its not utilizing the tor proxy, as the responses are coming back as if im recognized by the server</p>
  
  <p>do you know maybe why in the past i did not have to download privoxy, and now it must be downloaded and enabled?</p>
  
  <p>thank you</p>
  
  <p><strong>EDIT #2:</strong> <em>Testing</em></p>
  
  <p>i made now a simple test function like so:</p>
  
  <pre><code>    Function ExternalIP(Optional Proxy As Integer? = Nothing) As String
          Dim webClient = New WebClient
          webClient.Headers.Add("Cache-Control", "max-age=0")
          If Proxy.HasValue Then webClient.Proxy = New WebProxy("127.0.0.1", Proxy.Value)
          Dim ip = webClient.DownloadString("http://myip.ozymo.com/")
          webClient.Dispose()
          Return ip
      End Function
  </code></pre>
  
  <p>when used without passing a proxy, i get back my regular real ip. so far so good</p>
  
  <p>when i use 8118 as the proxy, then it depends:</p>
  
  <p>if privoxy is running then i get back my regular ip, (instead of the spoofed one which appears in the tor browser). which makes the whole thing pointless</p>
  
  <p>if its not running then i get the the above error <code>No connection could be made because the target machine actively refused it 127.0.0.1:8118</code></p>
  
  <p>just to recap, in the past ive used Tor itself (plus Vidalia) without Privoxy or anything like that, and it worked just fine.</p>
  
  <p>thank you</p>