0

I am trying to create a simple rss feed reader. I got this webresponse object but how to extract text,links from this?

WebResponse response = request.EndGetResponse(result);

Also,can anyone tell me what is the underlying framework behind all the working of windows phone 8.Is it known as Silverlight?I want to know it so that I can make relevant Google searches and don't bother you people time and again?

Rajat Saxena
  • 3,834
  • 5
  • 45
  • 63
  • You can use HttpClient instead. An example is available at this question: http://stackoverflow.com/questions/17408890/how-to-use-httpclient-in-windowsphone-8 – Patrick Aug 09 '13 at 15:07
  • 1
    If Windows Phone 8 doesn't get you any good results, I think you could search for winrt, windows 8, or windows store apps, as well as silverlight of course. – Patrick Aug 09 '13 at 15:11
  • Will it let me download the Images also? – Rajat Saxena Aug 09 '13 at 15:11
  • Well yeah, just use another "GetXXXAsync" method. They're all documented, http://msdn.microsoft.com/en-us/library/system.net.http.httpclient.aspx – Patrick Aug 09 '13 at 15:12
  • After some Googling,I got to know that it is not supported on Windows phone platform.Right? – Rajat Saxena Aug 09 '13 at 15:27
  • HttpClient is supported on windows phone 8 but you have to download using NuGet the portable library system.net.http released by microsoft, the httpClient simplify a lot the procedure for http request – Fabio Marcolini Aug 09 '13 at 15:41
  • Looks for **Portable HttpClient**. WP8 is based on the core of WinRT (ie. Windows 8). C# and XAML are the main technologies, and the 'Silverlight' label doesn't apply anymore. – Neil Turner Aug 10 '13 at 15:48

1 Answers1

1

It depends on what you want to do with it. You will need to get the Stream and then from there can turn it into a string (or other primitive type), just Json.Net to convert from json to an object, or you can use the stream to create an image.

using (var response = webRequest.EndGetResponse(asyncResult))
{
    using (var reader = new StreamReader(response.GetResponseStream()))
    {
        // need a string?
        string result = reader.ReadToEnd();

        // Need to convert from json?
        MyObject obj = Newtonsoft.Json.JsonConvert.DeserializeObject<MyObject>(result);

    }
}
Shawn Kendrot
  • 12,425
  • 1
  • 25
  • 41