Answer the question
In order to leave comments, you need to log in
Can't send a get request in c# .NET 2.0, what's wrong?
Windows XP SP3 + .NET Framework 2.0 SP2
Error 0xe0434f4d
string rs = "";
HttpWebRequest req = (HttpWebRequest)WebRequest.Create("https://2ip.ru/");
req.AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip;
req.Method = "GET";
req.KeepAlive = true;
req.Headers.Add("Upgrade-Insecure-Requests", "1");
req.UserAgent = "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36";
req.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8";
req.Headers.Add("Accept-Encoding", "gzip, deflate, br");
req.Headers.Add("Accept-Language", "ru-RU,ru;q=0.9,en-US;q=0.8,en;q=0.7");
req.Timeout = 10000;
HttpWebResponse response = (HttpWebResponse)req.GetResponse();
StreamReader reader = new StreamReader(response.GetResponseStream());
rs = reader.ReadToEnd();
response.Close();
Answer the question
In order to leave comments, you need to log in
req.AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question