Alternative to HttpClient for Windows Phone 7.5

xster
xster
Published in
1 min readNov 1, 2012

If you wanted to move your WinRT project to support Windows Phone 7.5, you’ll rejoice at the recent news that Microsoft’s Microsoft.bcl.Async package in Nuget that allows using Async keywords and Task class but in the end, you really used them in WinRT because HttpClient class had a GetAsync method which is not available outside WinRT.

Worry not, the Microsoft.bcl.Async package comes with a Microsoft.Threading.Tasks.Extensions assembly that if you look inside, includes:

public static System.Threading.Tasks.TaskGetResponseAsync(this System.Net.WebRequest source)
Member of AsyncExtensions

Which means you can use System.Net.WebRequest in its place and it supports Task/Async.

So you can do something like:

WebRequest request = WebRequest.Create(uri);
await request.GetResponseAsync();

--

--