在Watin中发送POST请求

在Watin中发送POST请求,post,automation,request,http-post,watin,Post,Automation,Request,Http Post,Watin,我正在尝试在具有基本身份验证的网页上发送POST请求。那么,是否有任何示例显示了如何在Watin中自动发送POST请求,我发现这是可行的 我的文档是一个json响应,我仍在努力通过WatiN访问它的原始内容——目前正在提示下载 IE _ie = new IE(); object flags = null; object targetFrame = null; object headers = "Content-Type: application/x-www-form-urlencoded" +

我正在尝试在具有基本身份验证的网页上发送POST请求。那么,是否有任何示例显示了如何在Watin中自动发送POST请求,我发现这是可行的

我的文档是一个json响应,我仍在努力通过WatiN访问它的原始内容——目前正在提示下载

IE _ie = new IE();
object flags = null;
object targetFrame = null;
object headers = "Content-Type: application/x-www-form-urlencoded" + Convert.ToChar(10) + Convert.ToChar(13);
object postDataBytes = ASCIIEncoding.ASCII.GetBytes("{ mydata: 5 }");
object resourceLocator = "http://google.com";
IWebBrowser2 browser = (IWebBrowser2)_ie.InternetExplorer;
browser.Navigate2(ref resourceLocator, ref flags, ref targetFrame, ref postDataBytes, ref headers);
_ie.WaitForComplete();