WebBrowser control and postdata

G

Gert

Hi,

I'm having some trouble using the new WebBrowser control in .NET 2.0.
(System.Windows.Forms.WebBrowser)

I'm trying to use the Navigate method to post form data (in my case, a
login form)...

This is the code I'm using:

------------------------------------------------------------------------------------
string url = "http://mysite.com/login.php";
string userName = textBoxUserName.Text;
string password = textBoxPassword.Text;
string postData = "username=" +userName+ "&password=" +password;
byte[] postDataBytes = ASCIIEncoding.ASCII.GetBytes(postData);
string headers = "Content-Type: application/x-www-form-urlencoded" +
"\n" + "\r";

m_browser.Navigate(url, "", postDataBytes, header);
------------------------------------------------------------------------------------

Am I doing something wrong, or is the WebControl not working???

Thx in advance,
Gert
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top