Firstly, you almost had it without the XmlReader; you can't load the response straight into the XDocument, but, most of the time you can do:
XDocument docs = XDocument.Load(new StreamReader(response.GetResponseStream()));
Then check docs.Nodes.Count.
If docs is still empty, it's time to look at the response itself. Look at the response.ContentType - what is it?
Assuming the response isn't too large, look at it! You can do:
StreamReader reader = new StreamReader(response.GetResponseSteam()); string text = reader.ReadToEnd();
You can dump that string anywhere. Alternatively, if it is very big, you can save the response to disk, using either a FileStream with your Response, or, more simply
Either should be good enough to get you one step closer.
XDocument docs = XDocument.Load(responseReader.Read());
XDocument docs = XDocument.Load(responseReader);
The method for XDocument will accept an XmlReader which is what responseReader is, however you are calling the .Read() method on which only returns a boolean which is why you are getting that error.
- LINQ Source Code Available
- .NET 4 Code Contracts: "requires unproven: source != null"
- Xdocument - Read value of attribute with Prefix
- creating Linq to sqlite dbml from DbLinq source code
- read icollection data using LINQ in C# code
- Read XML with Xdocument
- Read xml data using XDocument class
- Xdocument.Load(XMLReader.Read()) Is giving me erros
- I cannot read child elements in an xdocument
- How to use XDocument to read csproj files?
- Error when using XDocument in code behind
- Read last n elements of an XML file with Linq XDocument
- source code for LINQ 101 samples
- How to use XDocument to Read Multiple Embeded Elements
- read attribute using XDocument and LINQ
- LINQ to XML - Unable to read Elements or Descendants from XDocument or XElement
- c# code to read xml file values
- System.ArgumentNullException in code dealing with XDocument
- List or Array of String Contain specific word in Html Source Code
- Read XML with Elements and csv's into 2D array using XDocument in C#/XNA
- c# Linq or code to extract groups from a single list of source data
- Read values from XDocument
- XDocument To Read MetaBase.xml
- Read subfolder files by giving inner subfolder files priority?
- XMLDocument: Read XDocument and put contents into other XDocument (LINQ)(C#)
- How to use XDocument and Linq to read in a list of parent attribute concatenated with child comment
- Convert string to int in one line of code using LINQ
- LINQ to read XML
- Code equivalent to the 'let' keyword in chained LINQ extension method calls
- Value cannot be null. Parameter name: source
- How to execute stored procedure and get return result in MVC/EF/LINQ
- Can I use LINQ to do a join on an IQueryable from SQL Server?
- Get all Shots (table) related to a SessionId (table) where a third table named Results connects them through Result Id. using Linq
- contains in linq query
- Which model is the fastest using linq, foreign key relationships or local lists?
- C# - MVC - JSON - Return List From Server Side to Client Side Using ViewBag
- Count items in SQL Server
- linq to entities where condition issue
- Lambda Expression of Select * from TableName
- Instantiating Immutable Objects With Reflection
- Return unique list ordered by repeated/duplicated item count
- Select even/odd elements in IEnumerable<T>?
- SQL to LINQ converter required, any idea?
- Ordering a linq list based on a property of a child class
- How to filter on a list of keys in a Dictionary using LINQ
- Iterate custom class, Read Table
- list integers,for each index find the product of every integer except the that index
- DbFunctions DiffDays Gives wrong answer
- Linq How to combine List Items to other List items
- How do I write a LINQ query to combine multiple rows into one row?