HttpClient.SendRequestAsync throws System.Exception

1

I'm trying to create a generic method to sending HTTP operations using Windows.Web.Http.HttpClient. The method contains the following code:

HttpClient client = new HttpClient();

HttpRequestMessage request = new HttpRequestMessage(method, new Uri(URL));

if (!string.IsNullOrEmpty(param))
   request.Content = new HttpStringContent(param, UnicodeEncoding.Utf8, "application/json");

HttpResponseMessage response = await client.SendRequestAsync(request);

where param is a json string with parameters, can be empty.

Right after sending the request the program throws an exception with HRESULT: 0x80072EE7, but I haven't found a way for resolving the issue.

Any idea of what could be making this crash? Thanks in advance :)

c#
windows-phone-8.1
asked on Stack Overflow Nov 14, 2016 by Eva FP

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0