Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automated HTTP Form Submission

Status
Not open for further replies.

ChadJK

IS-IT--Management
Nov 10, 2005
14
0
0
US
How can I use VB.NET to do an HTTP form submission (method=POST) behind the scenes?

Basically, I need some VB.NET code to accomplish the same thing as clicking submit on the HTML form below would accomplish:

Code:
<form method="post" action="[URL unfurl="true"]http://www.myurl.com/default.aspx?formid=13">[/URL]
<input type="text" name="email" />
<input type="submit" value="Submit" />
</form>

I imagine this could be accomplished with WebClient or HttpWebRequest?
 
If the submit is a button on the website, you could get the element id and then use invokemember. Something like the following:

Dim hElement As HtmlElement = Nothing

hElement = Webmycontrol.Document.Window.Frames(0).Document.GetElementById("C1")

hElement.InvokeMember("click")

If it is java script behind the button or link, you could use Webmycontrol.Document.InvokeScript("thejavascriptfunction")

~CIAO~
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top