c# - 使用 Tor 作为代理

标签 c# proxy httpwebrequest tor

我试图在 HttpWebRequest 中使用 Tor-Server 作为代理,我的代码如下所示:

HttpWebRequest request;
HttpWebResponse response;

request = (HttpWebRequest)WebRequest.Create("http://www.google.com");
request.Proxy = new WebProxy("127.0.0.1:9051");

response = (HttpWebResponse)request.GetResponse();
response.Close();

它与“普通”代理完美配合,但使用 Tor 我在调用时遇到异常

GetResponse() 状态 = ServerProtocolViolation。消息是(德语...):Message = "Der Server hat eine Protokollverletzung ausgeführt.. Section=ResponseStatusLine"

最佳答案

如果你有privoxy安装并运行你可以做

request.Proxy = new WebProxy("127.0.0.1:8118"); // default privoxy port

这将使您能够使用 tor 发出请求

关于c# - 使用 Tor 作为代理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1962483/

相关文章:

c# - 如何在 ASP.NET Core Angular Web 应用程序中调用 Controller 的操作

c# - LINQ 查询(分组依据)?

php - PHP ssh2_tunnel:使用代理/ socks 抛出ssh服务器?

angularjs - 用于反向代理的 NodeJS 或 NGINX

c# - 我需要如何阅读/了解才能登录网站并执行操作?

c# - Speechsynthesizer (System.Speech.Synthesis.SpeechSynthesizer) - 在运行时更改音量或速率

c# - 错误 - 不允许连接字符串名称属性

ruby-on-rails - 在给定 URL 的情况下,替代 Apache 中的 X-sendfile 发送文件?

c# - 从 HttpWebRequest 切换到 HttpClient

batch-file - 来自批处理文件的 http Web 请求