0

I've decided to convert a Windows Phone 7 app that fetches an XML feed and then parses it to an asp.net web app, using Visual Web Developer Express. I figure since the code already works for WP7, it should be a matter of mostly copying and pasting it for the C# code behind.

HttpWebRequest request = HttpWebRequest.CreateHttp("http://webservices.nextbus.com/service/publicXMLFeed?command=routeConfig&a=sf-muni&r=" + line1);

That's the first line of code from my WP7 app that fetches the XML feed, but I can't even get HttpWebRequest to work in Visual Web Developer like that. Intellisense shows a create and createdefault, but no CreateHttp like there was in Windows Phone 7. I just need to figure out how to fetch the page, I assume the parsing will be the same as on my phone app. Any help?

Thanks,

Amanda

Amanda_Panda
  • 1,156
  • 4
  • 26
  • 68

3 Answers3

0

Just call WebRequest.Create().
You may need to cast the result to HttpWebRequest.

Note that the WebClient class makes this much easier.

SLaks
  • 868,454
  • 176
  • 1,908
  • 1,964
0

I have used the Asp.Net Rss Toolkit found here: http://aspnetrsstoolkit.codeplex.com/ It is a neat tool that will allow you to consume rss feeds. You can use their command line interface to create your c# or vb.net class with all of the property of your feed, therefore you don't have to parse anything. I totally recommend it.

Hanlet Escaño
  • 17,114
  • 8
  • 52
  • 75
0

This must be easier to use.

WebClient client = new WebClient(); String htmlCode = client.DownloadString("url");

VIRA
  • 1,454
  • 1
  • 16
  • 25