I am trying to parse the WebResponse I get from a multiform POST. I want to pull out the H3 tags, but when I go to document.Load the stream, I get null errors like this: "Cannot implicitly convert type 'void' to 'HtmlAgilityPack.HtmlNodeCollection' "
Now I understand my webresponse starts out null, but it fills up eventually. How can I get this to run with the streamreader returning null automatically?
//web response stuff here
WebResponse ricochet = webrreq.GetResponse();
Stream stream2 = ricochet.GetResponseStream();
StreamReader reader2 = new StreamReader(stream2);
HtmlAgilityPack.HtmlDocument document= new HtmlAgilityPack.HtmlDocument();
//line with null error below
var collection = document.Load(reader2.ReadToEnd());
For Posterity:
I can't assign the collection to document.Load, I first have to Load the stream and then use the Agility pack to find the right nodes again
var thingie = document.Load(reader2.ReadToEnd());
var collection = thingie.DocumentNode.SelectNode("//etc");