26511

GetStringAsync method in HttpClient throw an exception in WP8

Recently, I develop an App for WP8 and at the begining all worked OK. However, since yesterday nigth I was getting an error when trying to retrieve the RSS data from an url.

This is part of the code I use to get the data:

try { HttpClient client = new HttpClient(); var result = await client.GetStringAsync("http://www.scoop.it/t/recycling-by-miguel18/rss.xml"); var parseResult = XDocument.Parse(result); . . . } catch (Exception ex) { throw new Exception("Error: " + ex.Message); }

Where source is the string which contain the url to get the RSS data. As commented, at the begining it was working OK, I was able to get the data in work with it.

Now, it raise the following error: <strong>Response status code does not indicate success: 404 ().</strong>

If I put the url directly to any browser I can see the RSS feeds. So, I don't undertand what would be wrong with the code. I am a little lost.

If you can help me to figure out what is wrong that would be very helpful

Regards!

Answer1:

You need provide access to internet for your WP emulator.

This article can be helpful

connect WP emulator to internet

Answer2:

hmm... I also get same error... using own class to call API, first call on navigatedTo success, second call using button click error, both using same code. On chrome rest client, the url success.

Answer3:

Did you try adding an user-agent header? See DownloadString returns a 404 Error: Site needs a User-Agent Header.

Most webs blocks certain request to avoid robots. Try it and tell me please...

Recommend

  • Returning Error for Invalid Parse inside of `rep`
  • Problems with installing Hadoop on Ubuntu 12.04
  • how do you get window ID for xdotool automatically
  • How do you declare a the “nbsp” entity in XML document
  • Apple Api for Podcast App in Cocoa
  • Parse tag that lies within the of an rss2 feed item
  • Node.js get notification for high memory usage
  • What is spark.python.worker.memory?
  • simplepie not parsing google news rss feed
  • GetStringAsync method in HttpClient throw an exception in WP8
  • Node.js memory consumption OS X vs Linux
  • iCarousel not scrolling smoothly
  • how to RSSFeeds from Multiple Websites
  • How to verify if Java thread stack size is fixed or limited?
  • Saving parent_id relationship with ember data
  • Getting text from inside editText that is contained in a Recyclerview
  • How to swap two XML elements in linq to xml
  • Localstorage clearing after app store update?
  • XML delete node according to timestamp C#
  • Silverlight 4 OOB application access HTML DOM of the page in WebBrowser control
  • XslTransform with xml-stylesheet
  • How to read key/value in xml file
  • NPM MSSQL - error: uncaughtException: Cannot read property 'release' of null
  • Java - How to convert this string to date?
  • HTML elements in lxml get incorrectly encoded like Най
  • Converting a WriteableBitmap image ToArray in UWP
  • Play WS (2.2.1): post/put large request
  • Reading JSON from a file using C++ REST SDK (Casablanca)
  • Why value captured by reference in lambda is broken? [duplicate]
  • Java Scanner input dilemma. Automatically inputs without allowing user to type
  • Master page gives error
  • Cross-Platform Protobuf Serialization
  • javascript inside java/jsp code
  • Deserializing XML into class C#
  • Do I've to free mysql result after storing it?
  • Is there a mandatory requirement to switch app.yaml?
  • Turn off referential integrity in Derby? is it possible?
  • Can't mass-assign protected attributes when import data from csv file
  • sending mail using smtp is too slow
  • How to Embed XSL into XML