title: New identity for TOR using c#
body: <p>I'm using my TOR browser to connect to <code>.onion</code> websites and download data using c#. What I wanted to do, was add a button that allowed the user to get a new identity, but nothing I tried have worked so far.</p>
  
  <p>I've tried using telnet, sending a webrequest to the port 9151, running a vbs that was supposed to do this, but nothing worked.</p>
  
  <p>I have tried using TorSharp, but while that worked that only worked Async and I couldN't use that properly. I'm currently using <code>com.LandonKey.SocksWebProxy</code>.</p>
  
  <p>How could I do this?</p>
  
  <hr>
  
  <p>I'll add relevant code when I know what is needed, just ask.</p>
  
  <hr>
  
  <p>EDIT:</p>
  
  <p>@Ralph Wiggum</p>
  
  <p>Sadly I can't remember every way I've tried creating a new Identity, as I've said, I tried running a <code>VBS</code> using <code>Diagnostic.Process.Start()</code>, but i doN'T have that script any more. </p>
  
  <p>I also tried using <code>WebRequest</code> but I'm not even sure how that should be done.</p>
  
  <p>This is how that looked as i can remember:</p>
  
  <pre><code>com.LandonKey.SocksWebProxy.Proxy.ProxyConfig pc = new com.LandonKey.SocksWebProxy.Proxy.ProxyConfig();
  pc.SocksAddress = IPAddress.Parse(tb_Location.Text);
  pc.SocksPort = 9151;
  SocksWebProxy sw = new SocksWebProxy(pc);
  HttpWebRequest wreq = (HttpWebRequest)WebRequest.Create("http://127.0.0.1");
  wreq.Headers.Add("SIGNAL", "AUTHENTICATE \"\"");
  wreq.Headers.Add("SIGNAL", "NEWNYM");
  using (var wres = wreq.GetResponse())
  {
      using (var s = new StreamReader(wres.GetResponseStream()))
      {
          MessageBox.Show(s.ReadToEnd());
      }
  }
  </code></pre>
  
  <p>I also tried using telnet (using <code>PrimS.Telnet</code>), and that didn't work either. That looked something like this:</p>
  
  <pre><code>CancellationToken ct = new CancellationToken(); 
  PrimS.Telnet.Client c = new PrimS.Telnet.Client("127.0.0.1", 9151, ct);
  c.WriteLine("AUTHENTICATE \"\"\n");
  c.WriteLine("SIGNAL NEWNYM"); 
  </code></pre>
  
  <hr>
  
  <p>@drew010</p>
  
  <p>As I said, I did use <code>TorSharp</code> but I stopped. It was incredibly easy to create a new identity there, but it ran entirely Async, and I couldn't manage to fix it to use it with the rest of my code. </p>