Hi all
I have an ASP.NET MVC application and I'm trying to load the following html snippet from a Handler in another ASP.NET project, from one of my controllers to display in a View:
<br />
<div id="ctl00_divCommentary" class="commentary">
<div id="ctl00_divCommentaryHeader">
<span id="ctl00_lblCommentaryHeaderBold" class="commentaryHeader">blah</span>
<span id="ctl00_lblCommentaryHeader">blah</span>
</div>
<div id="ctl00_divCommentaryText" class="commentaryText">blah blah blah</div>
</div>
The code that I'm using to get that html snippet is as follows:
public string GetCommentary()
{
string commentary = "";
Uri uri = new Uri("http://localhost/Handlers/CommentaryHandler.ashx");
var doc = XDocument.Load(uri.ToString());
commentary = doc.ToString();
return commentary;
}
This is failing on the line
var doc = XDocument.Load(uri.ToString());
with the message "There are multiple root elements".
Is there a way to call that Handler and load the result into a string somehow?
Thanks
Dave