xster
Published in

xster

Alternative to HttpClient for Windows Phone 7.5

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

--

--

--

Collection of tech tips and learnings

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
xster

xster

More from Medium

Let’s get to know Docker

Quick local docker Ms Sql Server setup

Enabling MySQL Logs In The Linux Environment

Evaluating Docker Desktop 4.6’s new VirtioFS file sync on macOS

VirtioFS accelerated directory sharing in Docker Desktop 4.6