robespierre_2010
asked on
ASP.net C# streamreader
Hi experts,
I am trying to build an asp.net website that uses the result of an API call (see the attached code) and I have come across two issues that I hope someone can help with.
(1)I have a piece of code where I load into a streamreader the result of the call to an API. I am struggling to display the contents of that streamreader in my asp.net page. I have only managed to output the entire string, but I would like to be able to show different substrings of that string in ASP.NET objects such as labels, update panels, etc...So the first questio is: How can I break up the streamreader to show in these ASP.Net objects?
(2)Additionally, this is a call to an streaming API, which means that it keeps updating continuously. The additional question would then be: What ASP.NET object would be best suited to include the results of my streaming API call? My first assumption is it would be some AJAX control, with the update panel, etc..
Thanks a lot in advance and regards.
I am trying to build an asp.net website that uses the result of an API call (see the attached code) and I have come across two issues that I hope someone can help with.
(1)I have a piece of code where I load into a streamreader the result of the call to an API. I am struggling to display the contents of that streamreader in my asp.net page. I have only managed to output the entire string, but I would like to be able to show different substrings of that string in ASP.NET objects such as labels, update panels, etc...So the first questio is: How can I break up the streamreader to show in these ASP.Net objects?
(2)Additionally, this is a call to an streaming API, which means that it keeps updating continuously. The additional question would then be: What ASP.NET object would be best suited to include the results of my streaming API call? My first assumption is it would be some AJAX control, with the update panel, etc..
Thanks a lot in advance and regards.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Net;
using System.IO;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string url = "https://stream.twitter.com/1/statuses/filter.json?track=bilbao";
WebRequest request = WebRequest.Create(url);
request.Credentials = new NetworkCredential("","");
var webResponse = request.GetResponse();
Encoding encode = Encoding.GetEncoding("utf-8");
var responseStream = new StreamReader(webResponse.GetResponseStream(), encode);
Response.write(responseStream.ReadLine());
}
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.