There are times when you may want to cancel the HttpClient request that you made from your app , below is a sample code snippet demonstrating how to do it.
How to Cancel Http Client Request in Windows Phone 8.1 ?
async private void Button_Click(object sender, RoutedEventArgs e)
{
HttpClient client = new HttpClient();
var result = client.GetStringAsync(new Uri("http://www.abundantcode.com"));
var response = await result;
result.Cancel();
}
Leave a Reply