0

I had this code working but now suddenly it does not return "Response status code does not indicate success:404()".. what ever may be the URL it doesn't matter..

below is the code:

 protected async void getstring(string url)
    {
        HttpClient client = new HttpClient();
       client.DefaultRequestHeaders.TryAddWithoutValidation("User-Agent", "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/25.0");

        try
        {
            var html = await client.GetStringAsync(url);
            extractData(html);
        }
        catch (HttpRequestException e)
        {

            MessageBox.Show(e.Message);
            arrivalTime.Text = e.Message;
        }

        //time.Text = html;


    }
max_code
  • 307
  • 3
  • 14

0 Answers0