private async void Button_Click_3(object sender, RoutedEventArgs e) { try { HttpResponseMessage cont = await _downloadController.BrowsEmptyAsync(); TextBox2.Text = TextBox2.Text + cont.StatusCode.ToString(); } catch (Exception e1) { // Here it will be a HttpRequestException which is the last exception thrown. log.Info(e1); //throw; } }