(on the emulator) I have an application that is making get request to a .NET web API.
HttpClient httpClient = new DefaultHttpClient();
HttpContext localContext = new BasicHttpContext();
HttpGet httpGet = new HttpGet("http://10.0.2.2:64466/api/Products/1");
String text = null;
try {
HttpResponse response = httpClient.execute(httpGet, localContext);
HttpEntity entity = response.getEntity();
text = getASCIIContentFromEntity(entity);
} catch (Exception e) {
return e.getLocalizedMessage();
}
return text;
}
The API is made of ASP.net web application - web API project template, and it is currently running - I haven't post it on IIS(the url localhost:64466/api/Products/1 works correctly), but when I run the android app, it get an error - error 400 the request hostname is invalid.Maybe this is totally wrong way of approaching this, I am confused - would you kindly show me the error in the implementation or the tell me if the way I am doing it is totally wrong?