Windows Form WebBrowserコントロールのNavigateメソッドでPOSTを送信するには

2008年7月5日

param1というパラメータに”テスト”という文字列をセットして送信するC#のサンプル。

string params = “param1=” + HttpUtility.UrlEncode(“テスト”);
byte[] postData = new ASCIIEncoding().GetBytes(params);
string headers = “Content-Type: application/x-www-form-urlencoded\r\n”
webBrowser1.Navigate(“http://localhost/Test.aspx”, null, postData, headers);

コメントは受け付けていません。