HttpWebRequest “POST” returning server error (Exception)
问题 I'm trying to call the google URL shortner API from a WP7 app, I tried first on a Console Application by doing this: var httpWebRequest = (HttpWebRequest)WebRequest.Create("https://www.googleapis.com/urlshortener/v1/url"); httpWebRequest.ContentType = "application/json"; httpWebRequest.Method = "POST"; using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream())) { string json = "{\"longUrl\":\"http://www.google.com/\"}"; Console.WriteLine(json); streamWriter.Write(json); }