Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Search | Today's Posts | Mark Forums Read
BOOK: Professional C# 6 and .NET Core 1.0
This is the forum to discuss the Wrox book Professional C# 6 and .NET Core 1.0 by Christian Nagel; ISBN: 978-1-119-09660-3
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional C# 6 and .NET Core 1.0 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 20th, 2017, 10:46 AM
Registered User
Points: 5, Level: 1
Points: 5, Level: 1 Points: 5, Level: 1 Points: 5, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Feb 2017
Posts: 1
Thanks: 1
Thanked 0 Times in 0 Posts
Question XDocument.Load

On p812, in chapter 27, a code fragment is listed which tries to load an http stream directly into an XDocument. It generates this error message:
"Cannot open 'http://blog.cninnovation.com/feed/atom/'. The Uri parameter must be a file system relative or absolute path."

Am I missing something?
Reply With Quote
  #2 (permalink)  
Old February 20th, 2017, 12:47 PM
Wrox Author
Points: 1,163, Level: 13
Points: 1,163, Level: 13 Points: 1,163, Level: 13 Points: 1,163, Level: 13
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Sep 2010
Location: Austria
Posts: 175
Thanks: 3
Thanked 53 Times in 53 Posts

Hi Nico,
thanks for this information. This was a change with .NET Core that I missed.
Making HTTP Requests with XDocument.Load is now only available from the full .NET Framework. XDocument.Load only loads it locally. I've made a change to the sample code to use the HttpClient before using XDocument:

var httpClient = new HttpClient();
using (Stream stream = await httpClient.GetStreamAsync("http://csharp.christiannagel.com/feed/atom/"))
    XNamespace ns = "http://www.w3.org/2005/Atom";
    XDocument doc = XDocument.Load(stream);
The code is already available on https://github.com/ProfessionalCShar...ssionalCSharp6

Hope this helps,
CN innovation
Visit my blog at: csharp.christiannagel.com
Follow me on twitter: @christiannagel
Reply With Quote
The Following User Says Thank You to ChristianNagel For This Useful Post:
nico@wittyman.nl (February 21st, 2017)

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[C# net 4] Load page please wait (not updating but page load) cms9651 ASP.NET 4 General Discussion 0 May 4th, 2013 05:35 PM
Load Repeater (Data)content on the page load? master777 ASP.NET 4 General Discussion 8 April 11th, 2013 08:21 PM
Load Repeater (Data)content on page load? master777 BOOK: Beginning ASP.NET 4 : in C# and VB 1 April 10th, 2013 02:32 AM
Why Can't I get CSS to load ? vincej BOOK: Professional CodeIgniter ISBN: 978-0-470-28245-8 1 September 15th, 2011 10:43 PM
Error during load neetagp_21 Beginning VB 6 0 February 21st, 2007 02:16 AM

All times are GMT -4. The time now is 05:39 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.