我们可以直接在浏览器中使用查询字符串(GET数据)打开页面。 有没有办法直接在有POST DATA的浏览器中打开页面。
答案 0 :(得分:0)
使用WebBrowser控件打开包含帖子数据的网址:
string url = "http://example.com";
string postData = "param1=value1¶m2=value2¶m3=value3";
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);