Http Head request RRS feed

  • Question

  • User46621 posted

    Hi guys, I'm trying to make a simple HEAD request to google. This is my code:

    using (var client = new HttpClient()) { var m = new HttpRequestMessage(HttpMethod.Head, "http://google.com"); var resp = await client.SendAsync(m); }

    But when I run it, i get the following exception: System.Net.WebException: The request requires buffering data to succeed. at System.Net.HttpWebRequest.Redirect (System.Net.WebAsyncResult result, HttpStatusCode code, System.Net.WebResponse response) [0x00000] in :0 at System.Net.HttpWebRequest.CheckFinalStatus (System.Net.WebAsyncResult result) [0x00000] in :0 at System.Net.HttpWebRequest.SetResponseData (System.Net.WebConnectionData data) [0x00000] in :0

    I also tryed using WebRequest but the problem remain the same: WebRequest r = WebRequest.CreateDefault (new Uri("http://www.google.com")); r.Method = "HEAD"; var c = await r.GetResponseAsync ();

    I think it's a bug, infact on a Console Application the code posted above works perfectly

    Wednesday, August 27, 2014 8:34 AM

All replies

  • User17541 posted

    I have also been hit with this on mono 3.8.0 on OSX.

    Sunday, September 14, 2014 12:54 PM
  • User23601 posted

    same here..

    Thursday, October 30, 2014 12:46 PM
  • User8658 posted

    I had the same problem. I fixed by changing the URL to an actual page and not a redirect. Try using ......URL = http://www.google.com/sites/overview.html

    Tuesday, November 11, 2014 1:44 PM
  • User1909 posted

    I've got a DropBox link that is controlled by the customer's suppliers. I can't change. This used to work but now seems to be broken. Any other workarounds?

    Friday, January 9, 2015 8:08 AM