Use Webbrowser control to get and post data?

24,156

I do something like this and it works for me.

string postData = "value1=" + 1 + "&value2=" + 2 + "&value3=" + 3;
System.Text.Encoding encoding = System.Text.Encoding.UTF8;
byte[] bytes = encoding.GetBytes(postData);
string url = "http://www.domain.com/addSomething";
webBrowser1.Navigate(url, string.Empty, bytes, "Content-Type: application/x-www-form-urlencoded"); 

I hope it is of help.

Share:
24,156
Ivan-Mark Debono
Author by

Ivan-Mark Debono

Updated on May 05, 2020

Comments

  • Ivan-Mark Debono
    Ivan-Mark Debono about 4 years

    I have a windows form with a webbrowser control. Using this control, I need login to a website, and get and post data.

    The login part will remain manually because various headers and cookies and created and stored.

    However, is it possible to use the control to send post/get requests?