title: Unable to send updates to Twitter using the following code. No error
body: <p>I tried the following code:</p>
  
  <pre><code> static void PostTweetanother(string username, string password, string tweet)
      {
          try
          {
              // encode the username/password
              string user = Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(username + ":" + password));
              // determine what we want to upload as a status
              byte[] bytes = System.Text.Encoding.ASCII.GetBytes("status=" + tweet);
              // connect with the update page
              HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://twitter.com/statuses/update.xml");
              // set the method to POST
              request.Method = "POST";
              request.ServicePoint.Expect100Continue = false; // thanks to argodev for this recent change!
              // set the authorisation levels
              request.Headers.Add("Authorization", "Basic " + user);
              request.ContentType = "application/x-www-form-urlencoded";
              // set the length of the content
              request.ContentLength = bytes.Length;
  
              // set up the stream
              Stream reqStream = request.GetRequestStream();
              // write to the stream
              reqStream.Write(bytes, 0, bytes.Length);
              // close the stream
              reqStream.Close();
          }
          catch (Exception ex) { throw ex; }
      }
  </code></pre>
  
  <p>I also tried this code:</p>
  
  <pre><code> static void PostTweet(string username, string password, string tweet)
      {
          // Create a webclient with the twitter account credentials, which will be used to set the HTTP header for basic authentication
          WebClient client = new WebClient { Credentials = new NetworkCredential { UserName = username, Password = password } };
  
          // Don't wait to receive a 100 Continue HTTP response from the server before sending out the message body
          ServicePointManager.Expect100Continue = false;
  
          // Construct the message body
          byte[] messageBody = Encoding.ASCII.GetBytes("status=" + tweet);
  
          // Send the HTTP headers and message body (a.k.a. Post the data)
          client.UploadData("http://twitter.com/statuses/update.xml", messageBody);
      }
  </code></pre>