I am trying to send the same information from my application as I am sending from a browser. Here is some of the data captured by Fiddler:
POST http://something/ HTTP/1.1 Host: something.com Connection: keep-alive
I am stuck with this join property. If I set the keep-alive property to true, in Fiddler I see the following:
Proxy Connection: Keep-Alive
If I try to set the Keep-alive connection property, I get this error:
Keep-Alive and Close cannot be set using this property.
How to write code so that in Fiddler I can see this:
Connection: keep-alive
My full code is:
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://myUrl "); request.Method = "POST"; request.ProtocolVersion = HttpVersion.Version11; request.Accept = "*/*"; WebHeaderCollection headers = new WebHeaderCollection(); headers.Add("Accept-Encoding", "myEncoding"); headers.Add("Accept-Language", "myLang"); request.Headers = headers; request.ContentType = "myContentType"; request.Referer = "myReferer"; request.UserAgent = "myUserAgent"; ASCIIEncoding encoding = new ASCIIEncoding(); string postData = "myData"; byte[] data = encoding.GetBytes(postData); request.GetResponse().Close();
source share