title: Google Translate V2 cannot hanlde large text translations from C#
body: <p>I've implemented C# code using the Google Translation V2 api with the GET Method.
  It successfully translates small texts but when increasing the text length and it takes 1,800 characters long ( including URI parameters ) I'm getting the "URI too large" error.</p>
  
  <p>Ok, I burned down all the paths and investigated the issue across multiple pages posted on Internet. All of them clearly says the GET method should be overriden to simulate a POST method ( which is meant to provide support to 5,000 character URIs ) but there is no way to find out a code example to of it.</p>
  
  <p>Does anyone has any example or can provide some information?</p>
  
  <p>[<strong>EDIT</strong>] Here is the code I'm using:</p>
  
  <pre><code>String apiUrl = "https://www.googleapis.com/language/translate/v2?key={0}&amp;source={1}&amp;target={2}&amp;q={3}";
              String url = String.Format(apiUrl, Constants.apiKey, sourceLanguage, targetLanguage, text);
              Stream outputStream = null;
  
          byte[] bytes = Encoding.ASCII.GetBytes(url);
  
          // create the http web request
          HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(url);
          webRequest.KeepAlive = true;
          webRequest.Method = "POST";
          // Overrride the GET method as documented on Google's docu.
          webRequest.Headers.Add("X-HTTP-Method-Override: GET");
          webRequest.ContentType = "application/x-www-form-urlencoded";
  
          // send POST
          try
          {
              webRequest.ContentLength = bytes.Length;
              outputStream = webRequest.GetRequestStream();
              outputStream.Write(bytes, 0, bytes.Length);
              outputStream.Close();
          }
          catch (HttpException e)
          {
              /*...*/
          }
  
          try
          {
              // get the response
              HttpWebResponse webResponse = (HttpWebResponse)webRequest.GetResponse();
              if (webResponse.StatusCode == HttpStatusCode.OK &amp;&amp; webRequest != null)
              {
                  // read response stream 
                  using (StreamReader sr = new StreamReader(webResponse.GetResponseStream(), Encoding.UTF8))
                  {
                      string lista = sr.ReadToEnd();
  
                      DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(TranslationRootObject));
                      MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(lista));
                      TranslationRootObject tRootObject = (TranslationRootObject)serializer.ReadObject(stream);
                      string previousTranslation = string.Empty;
  
                      //deserialize
                      for (int i = 0; i &lt; tRootObject.Data.Detections.Count; i++)
                      {
                          string translatedText = tRootObject.Data.Detections[i].TranslatedText.ToString();
                          if (i == 0)
                          {
                              text = translatedText;
                          }
                          else
                          {
                              if (!text.Contains(translatedText))
                              {
                                  text = text + " " + translatedText;
                              }
                          }
                      }
                      return text;
                  }
              }
          }
          catch (HttpException e)
          {
              /*...*/
          }
  
          return text;
      }
  </code></pre>