TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Amit Joshi
NA
2
7k
Xamarin Forms HttpClient not working
Nov 23 2016 11:59 PM
Hi,
I am new to Xamarin Cross-Flatform technology (C#). I am developing one small application where I need to call the http url, get the json data, parse it and display it on the screen.
I am using System.Net.Http for achieving the http call. Below is the code i am using to achieve it.
But request is not reaching to http url
namespace EmployeeInfo
{
class HttpCommunicator
{
public async Task<RootObject> sendRequest()
{
RootObject rootObject = new RootObject();
HttpClient client = new HttpClient();
HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, "http://192.168.1.36:8080/JsonReader/JsonReader");
var result = await client.SendAsync(request);
result.EnsureSuccessStatusCode();
var content = await result.Content.ReadAsStringAsync();
//client.BaseAddress = new Uri("http://172.19.4.176:8080/JsonReader/JsonReader");
//var response = await client.GetAsync("http://172.19.4.176:8080/JsonReader/JsonReader");
//var placesJson = response.Content.ReadAsStringAsync().Result;
if ( null != content)
{
rootObject = Newtonsoft.Json.JsonConvert.DeserializeObject<RootObject>(content);
}
return rootObject;
}
}
}
Reply
Answers (
1
)
Accordion control in xamarin forms android
How to bend a Listview in UWP to an angle