I am trying to send httpwebrequest using tor proxy with my asp.net application and I get this error message when calling the webresponse.GetResponse () method:
The server committed a protocol violation. Section = ResponseStatusLine
I tried to find a solution on the Internet, and I found 3 main solutions to this error:
Each of these solutions did not change anything in the error message.
Here's the request code:
WebRequest.DefaultWebProxy = new WebRequest("127.0.0.1:9051"); HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(url); webRequest.CookieContainer = new CookieContainer(); webRequest.ProtocolVersion = HttpVersion.Version10; webRequest.KeepAlive = false; webRequest.Method = "GET"; webRequest.ContentType = "application/x-www-form-urlencoded"; webRequest.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"; webRequest.UserAgent = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.168 Safari/535.19"; HttpWebResponse webResponse = (HttpWebResponse)webRequest.GetResponse(); StreamReader streamReader = new StreamReader(webResponse.GetResponseStream()); string html = streamReader.ReadToEnd(); webResponse.Close(); return html;
Can someone help me find a solution for this?
Imri barr
source share