title: C# Login to https Website via program
body: <p>I want to login to website <a href="https://ssl.aukro.ua/enter_login.php" rel="nofollow">https://ssl.aukro.ua/enter_login.php</a> with following credential parsing and stackoverflow1 </p>
  
  <p>I am using following code and it is not working</p>
  
  <pre><code>HttpWebRequest http = WebRequest.Create("https://ssl.aukro.ua/enter_login.php") as HttpWebRequest;
  http.KeepAlive = true;
  http.Method = "POST";
  http.ContentType = "application/x-www-form-urlencoded";
  string postData = "user_login=" + "parsing" + "&amp;user_password=" + "stackoverflow1";
  byte[] dataBytes = UTF8Encoding.UTF8.GetBytes(postData);
  http.ContentLength = dataBytes.Length;
  using (Stream postStream = http.GetRequestStream())
  {
      postStream.Write(dataBytes, 0, dataBytes.Length);
  }
  HttpWebResponse httpResponse = http.GetResponse() as HttpWebResponse;
  // Probably want to inspect the http.Headers here first
  http = WebRequest.Create("http://aukro.ua/myaccount/bid.php") as HttpWebRequest;
  http.CookieContainer = new CookieContainer();
  http.CookieContainer.Add(httpResponse.Cookies);
  HttpWebResponse httpResponse2 = http.GetResponse() as HttpWebResponse;
  </code></pre>