Alright please bear with me for few posts, I am trying to design a scoreboard application using HTML. The data for scoreboard (including headings and rows and columns) are stored on a server at a remote location. I am trying to develop an ASP.NET script to fetch that XML and convert it into JSON so that I could pick up via jQuery or something else at browser level.
here comes the tough part: I have little experience in C#.NET and have no experience in ASP.NET, I use my scrapings of PHP knowledge and try to find equivalent in ASP.NET.
The first thing I've thought of was to use cURL like alternative to fetch the xml from servers and that didn't go well as there is no cURL equivalent in .NET except to use cURL which I don't want to. I have looked online and found many REST clients examples and have used it in my application which is all good and dandy so far, but the result I'm expecting is not what it's displaying.
This is my code so far
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string scoreboardurl = @"http://www.w3schools.com/xml/cd_catalog.xml";
Response.Write(HttpGet(scoreboardurl));
}
static string HttpGet(string url)
{
/** http://stackoverflow.com/a/1605921 **/
HttpWebRequest req = WebRequest.Create(url) as HttpWebRequest;
req.Method = "GET";
string result = string.Empty;
using (HttpWebResponse resp = req.GetResponse() as HttpWebResponse)
{
using (StreamReader reader = new StreamReader(resp.GetResponseStream()))
{
result = reader.ReadToEnd();
}
}
return result;
}
}
All I want to do is to save these xml elements/nodes so they could be converted to json object
So, can anyone point me in the right direction ?