HttpWebRequest HttpWebRequest = (HttpWebRequest)WebRequest.Create(path + get_body);
HttpWebRequest.AllowAutoRedirect = bAutoRedirect;
HttpWebRequest.CookieContainer = new CookieContainer();
if (Cooks != null)
{
HttpWebRequest.CookieContainer.Add(Cooks);
}
HttpWebRequest.Method = "GET";
HttpWebRequest.ContentType = "application/x-www-form-urlencoded";
HttpWebRequest.Proxy = new WebProxy("127.0.0.1", 8888);
HttpWebResponse HttpWebResponse = (HttpWebResponse)HttpWebRequest.GetResponse();
if (HttpWebResponse.Cookies != null)
{
Cooks.Add(HttpWebResponse.Cookies);
}
return HttpWebResponse;
}
catch (WebException ex)
{
return ex.Response as HttpWebResponse;
}
WebResponse
Код:
Код:
httpWebResponse = client.Request_Get("http://somesite.ru/", "inf.pl?119",false);
if (httpWebResponse != null && httpWebResponse.StatusCode == HttpStatusCode.OK)
{
Stream stream = httpWebResponse.GetResponseStream();
using (StreamReader reader = new StreamReader(stream, System.Text.Encoding.GetEncoding(1251)))
{
sHTML = reader.ReadToEnd();
textBox8.Text = sHTML;
reader.Close();
stream.Close();
}
}
if (httpWebResponse != null && httpWebResponse.StatusCode == HttpStatusCode.OK)
{
Stream stream = httpWebResponse.GetResponseStream();
using (StreamReader reader = new StreamReader(stream, System.Text.Encoding.GetEncoding(1251)))
{
sHTML = reader.ReadToEnd();
textBox8.Text = sHTML;
reader.Close();
stream.Close();
}
}
чуток разобрался, страница приходит в gzip, теперь другой вопрос, как ее оттуда вытащить?
все, ответ нашел (: