This project has moved and is read-only. For the latest updates, please go here.

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

Topics: Developer Forum
Feb 23, 2015 at 10:36 PM
Edited Feb 23, 2015 at 10: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("")
            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="">
<form action="index.php" method="get" style="clear:left">
<td class="tfoot" align="right" width="100%">
        <div class="smallfont">
                <a href="" rel="nofollow" accesskey="9">Contact Us</a> -
                <a href="">Steam Store</a> -

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