My board:
ID: Meadow by Wilderness Labs, Model: F7Micro, MeadowOS Version: 0.4.6 (Mar 14 2021 03:33:22), Processor: STM32F777IIK6, Processor Id: 26-00-30-00-0a-51-36-35-32-38-33-34, Serial Number: 346338623536, CoProcessor: ESP32, CoProcessor OS Version: 0.4.6.0, Mono Version: 0.0.0.1, Device Name: MeadowF7
When I’m running the code below I’m getting an Access denied error.
This code worked for me in version 4.5
Can someone tell me what I’m missing?
Thanks,
John
string Uri = "http://worldtimeapi.org/api/timezone/Europe/Brussels.json";
using (HttpClient client = new HttpClient())
{
try
{
client.Timeout = new TimeSpan(0, 5, 0);
HttpResponseMessage response = await client.GetAsync(Uri);
response.EnsureSuccessStatusCode();
string responseBody = response.Content.ReadAsStringAsync().Result;
Console.WriteLine(responseBody);
}
catch (TaskCanceledException)
{
Console.WriteLine("Request time out.");
}
catch (Exception e)
{
Console.WriteLine("error: " + e.Message);
}
}