Http Head request

alberto.8709alberto.8709 albertoUSMember
edited August 2014 in General

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, ""); 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("")); 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


Sign In or Register to comment.