Wrox Programmer Forums
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old February 20th, 2017, 10:46 AM
Registered User
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?
Old February 20th, 2017, 12:47 PM
Wrox Author
Join Date: Sep 2010
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
The Following User Says Thank You to ChristianNagel For This Useful Post:
nico@wittyman.nl (February 21st, 2017)

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

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