Wednesday, June 8, 2011

Posting Data To WebBrowser Control

Basically, it is possible to post data to web browser control. The code below, was referenced from MSDN, but i slightly modified some of it's functionalities.
string url = "http://example.com";  
string postData = String.Format("city=DC&Page={0:00}",pageNum);  
byte[] Post = Encoding.UTF8.GetBytes(postData );  
string AdditionalHeaders = "Content-Type: application/x-www-form-urlencoded";  
//wbSample is the web browser control  
//the WebNavigate method is just a simple method i created  
//which simply assigns url to the browser, the post data and additional headers  
WebNavigate(wbSample , ListURL, "", Post, AdditionalHeaders);

0 comments:

Post a Comment