3

Having dealt previously with WebView, it distinguishes between loadUrl() and postUrl().

But WebBrowser only has the Navigate() method which seems to be taking a different approach by providing (an optional?) postData parameter.

How does that work? Is there a tutorial out there (with sample code) that demonstrates how to use it?

Update1: I just found this tip, which doesn't really show any code but cautions in regard to using POST in WebBrowser.

Update2: This thread is better than nothing.

Community
  • 1
  • 1
ih8ie8
  • 944
  • 8
  • 23
  • 1
    Don't have code sample but maybe [this thread](http://stackoverflow.com/a/975699) can help. – Souper Oct 20 '12 at 15:13
  • 1
    And code can be found through [this thread](http://stackoverflow.com/q/8065856): [No WebBrowser](http://stackoverflow.com/a/931030) and [Yes WebClient](http://www.hanselman.com/blog/HTTPPOSTsAndHTTPGETsWithWebClientAndCAndFakingAPostBack.aspx). – Souper Oct 20 '12 at 15:57

1 Answers1

1

In Windows Forms' WebBrowser you post data by calling the form's InvokeMember("submit"):

If you know the ID of the form you would like to submit:

HtmlElement form = webBrowser1.Document.GetElementById("FormID");
if (form != null)
    form.InvokeMember("submit");
Community
  • 1
  • 1
ateiob
  • 9,016
  • 10
  • 44
  • 55