var client = new HttpClient(); HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, "api.openweathermap.org/data/2.5/weather?q=" + cityName + "," + countryName); var response = await client.SendAsync(request); if (response.StatusCode == System.Net.HttpStatusCode.OK) { var result = response.Content; string restultString = await result.ReadAsStringAsync(); // var data = JsonConvert. var data = JsonConvert.DeserializeObject<RootObject>(restultString); lblWeatherResults.Text = data.sys.country.ToString() +" - "+ data.main.temp.ToString(); }
An Invalid request URL was provided. The ruquest URL must either be an absolute URL or BaseAddress must be set.
HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, "http://api.openweathermap.org/data/2.5/weather?q=" + cityName + "," + countryName);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)