Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


how to enable cookie in httpwebrequest ? c#

New BinaryNew Binary Member Posts: 3

CookieContainer c = new CookieContainer();
void getrespense(string link)
var request = (Requestionner)WebRequest.Create(link);
var data = Encoding.ASCII.GetBytes(string.Format("sf_url={0}&sf_submit=&new=1&lang=en&app=: undefined", textBox1.Text));
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = data.Length;
request.CookieContainer = c;
using (var stream = request.GetRequestStream())
stream.Write(data, 0, data.Length);
var response = (HttpWebResponse)request.GetResponse();
var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();


Sign In or Register to comment.