Question Get HtmlElement From a Stream

assafey

Member
Joined
Apr 13, 2009
Messages
10
Programming Experience
1-3
Hi,
I want to get links of a site from a stream.
I tried this code but it is not working.

VB.NET:
ListBox1.Items.Clear()
        Dim request As WebRequest = HttpWebRequest.Create("http://www.mysite.com/")
        Dim response As WebResponse = request.GetResponse()
        Dim stream As Stream = response.GetResponseStream()
HTMLInputElement)
        Dim document As HtmlDocument = HtmlDocument.Create(stream)
        stream.Close()
        response.Close()
        richTextBox1.Text = document.Html
        For Each node As HtmlNode In document.Nodes
            Dim element As HtmlElement = TryCast(node, HtmlElement)
            If element IsNot Nothing Then
                If element.Attributes.Contains("href") Then
                    ListBox1.Items.Add(element.ToString())
                End If
            End If
        Next

PLS help.
 
Top Bottom