extracting all forms from an html page with all their inputs using HtmlAgilityPack and VB.NET

Topics: Developer Forum
Feb 23, 2015 at 9:36 PM
Edited Feb 23, 2015 at 9:37 PM
How can I get all the forms from a page using HtmlAgilityPack with all their input fields. I have the following code:
            Dim Web As New System.Net.WebClient
            Dim htdoc As New HtmlAgilityPack.HtmlDocument
            Dim page As String = ""
            page = Web.DownloadString("http://test.com/student/register.php")
            For Each item As HtmlNode In htdoc.DocumentNode.Descendants("form")

        Catch ex As Exception
        End Try
example of an html page:
<form action="register.php?do=checkdate" method="post" onsubmit="return checkform(this)">
<input type="hidden" name="do" value="checkdate">
<input type="hidden" name="s" value="X">
<input type="hidden" name="securitytoken" value="guest">
<input type="hidden" name="url" value="https://www.google.com/">
<form action="index.php" method="get" style="clear:left">
<td class="tfoot" align="right" width="100%">
        <div class="smallfont">
                <a href="https://support.test.com/?s=5413e493b8e32114ba2ff4d2e038ace3" rel="nofollow" accesskey="9">Contact Us</a> -
                <a href="http://store.test.com/">Steam Store</a> -

            <a href="archive/index.php">Archive</a> -
                <a href="http://store.test.com/privacy_agreement/">Privacy Statement</a> -
                <a href="http://store.test.com/subscriber_agreement/">Terms of Service</a> -
                <a href="#top" onclick="self.scrollTo(0, 0); return false;">Top</a>
<form id="searchform" name="searchform" method="get" action="http://store.test.com/search/" onsubmit="return SearchSuggestCheckTerm(this);">
all i get after executing this code is the form tag without its descendants.