I'm using Xamarin Forms to consume REST Api from NetFlix but i get this issue in Popup: System.Net.WebException: Error: NameResolutionFailure
Why o get this error?
My Code:
private HttpClient client = new HttpClient();
private List<Movie> movies;
public async Task<List<Movie>> LocalizaFilmesPorAtor(string ator)
{
if (string.IsNullOrWhiteSpace(ator))
{
return null;
}
else
{
string url = string.Format("http://netflixroulette.net/api/api.php?actor={0}", ator);
var response = await client.GetAsync(url);
if (response.StatusCode == HttpStatusCode.NotFound)
{
movies = new List<Movie>();
} else
{
var content = await response.Content.ReadAsStringAsync();
var _movies = JsonConvert.DeserializeObject<List<Movie>>(content);
movies = new List<Movie>(_movies);
}
return movies;
}
}
In debug mode said the error is in this code
string url = string.Format("http://netflixroulette.net/api/api.php?actor={0}", ator);
var response = await client.GetAsync(url);
He stops in there, the url recive the url + actor name but in next line the response stay null.
PS: I give Internet permission to my App in Manifest!